diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index cd451544ba17b3705929e8b4edab10b0e1764d4b..a0786b62c1b2e973ae135acc27e53375d3e12d35 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,23 +1,23 @@ -Cover Charge v0.3.12.212: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.212. +Cover Charge v0.3.12.214: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.214. SHA-256 of each web app's start page, service worker, manifest and logo: -1de761c85f3e4512e68d5c0f2cbaae7455e35124d2ffba70f22e35d598fdbd4b owner-app/index.html -34fb7f64a54514c82af9d9947be1caabac6075d3e8d4b47c9a39e17efdf9c2a2 owner-app/sw.js +d2a05fbb5bda1869db9fffccc00327c901da5ecaf43192e001e3faba7b2fccc3 owner-app/index.html +a2892e30c1297dabde1aacf450c79af28ee3a26519f273c861369e85afc80511 owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -c44f32ab84f906a1233db6981c79270f4e59b8f8370fb78084967862a26dbd76 staff-app/index.html -0cf78b293b462518247aae6411e1217475290c8f360a66d00d18ae8082de2566 staff-app/sw.js +8ceb8eeca283485b6114d84d1c9f412c81014a534238af52d49d6d07910779a1 staff-app/index.html +b8d99ffcb6542d5478cdf53901436da55275a933b415792764ba7ecda788210e staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -fe2c8b97c0d229039b65e60401b69f337e948f54bdaaeb24a73574ba11b18c4f customer-app/index.html -66345515cd959840823c53cab32b1e4da75b950175c714013235dfe898497d05 customer-app/sw.js +bc06b94119ba7e19572ccb21119134a0c7a579edc9aea3b6a69a33c830014ec9 customer-app/index.html +6cd51ffdbc1be743a08ab4dfec675984d9219774df85c6e229e3160830ffd742 customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -a8f3cc0762f2266942e653da738a103ba178ad91e66be065de3c7b21aaf31563 display-app/index.html -7c4f8547f3a678e4fb4f473cc026c16a45fd281978ae570ed5023acad1e3c774 display-app/sw.js +c4040806985ca6d82f8c5b1d15acfc33a6a29c8cb459aac32f63dffb9f7224d6 display-app/index.html +946685287a4096974e36076a0b9c8c1746b8e6f4b56d4428ba4af96b8b7a02b8 display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -e19f08f75ba1c66c5344d79b297b43fe270da2b336d885ea14f0d08d06601d9e chef-app/index.html -d80f35deb4a8829248f4c766f48959f7c2ab5bd1b59ad4e69684ef693b27e822 chef-app/sw.js +1cc96ab5910ab0afb789abe28f98856b24dd506c9ca06f10791c5508bf90cbaf chef-app/index.html +3f3b7fe84d93bfb7c24457fa83d7df64d380c401740acfc621b1f792f501dd80 chef-app/sw.js 97ed43decde8a888e22b7411e13a2122c6f8b9944cf38b2e28e8f62ef2e25397 chef-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 chef-app/brand-logo.png diff --git a/car-app/_expo/static/js/web/bundle.js b/car-app/_expo/static/js/web/bundle.js index ded2b15d81b6b3cd18d3aa89aedffdb57caee0de..5849b840d54e66410a839b56e2c0f1d8d4239415 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1185,1188,1199,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1186,1189,1185,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1262,27 +1262,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_DELIVERY_NOTE",{enumerable:!0,get:function(){return t}});const t=null},1179,[]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpOverTime=function({rid:e,width:b}){const $=(0,n.useGpCalcView)(),P=(0,o.useRecipeCards)(e),[w,k]=(0,s.useState)('3m'),[v,D]=(0,s.useState)(b??0),_=(0,s.useMemo)(()=>P.map(e=>({id:e.id,dish:e.dish,price:e.price})),[P]),M=(0,s.useMemo)(()=>(0,a.menuGp)($.ingredients,$.cardCosts??{},_,$.settings),[$.ingredients,$.cardCosts,_,$.settings]),G=(0,s.useMemo)(()=>(0,a.gpHistory)(Object.values($.deliveries??{}),M,w),[$.deliveries,M,w]),T=(0,s.useMemo)(()=>M.dishes.map(e=>{const s=G.points.find(s=>null!=s.dishes[e.id])?.dishes[e.id];return{...e,ch:null!=s?e.gp-s:0}}).sort((e,s)=>Math.abs(s.ch)-Math.abs(e.ch)),[M.dishes,G.points]),[A,I]=(0,s.useState)(null),C=(A??T.slice(0,3).map(e=>e.id)).filter(e=>T.some(s=>s.id===e)).slice(0,3),L=(0,a.gpSummary)(G.points,w),F=240,S=(0,s.useMemo)(()=>v>0?(0,u.gpChartLayout)(v,F,G.points,C,M.dishes.map(e=>e.target)):null,[v,G.points,C,M.dishes]),z=e=>M.dishes.find(s=>s.id===e)?.name??G.names[e]??'Dish';return(0,p.jsxs)(d.Box,{testID:"gp-over-time",children:[(0,p.jsx)(r.T,{size:20,weight:"bold",center:!0,colour:c.colours.gold,accessibilityRole:"header",children:"GP over time"}),(0,p.jsx)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['4w','3m','12m'].map(e=>(0,p.jsx)(h.Pick,{testID:`gp-range-${e}`,label:a.RANGE_SAID[e],accessibilityLabel:`Show ${a.RANGE_SAID[e]}`,selected:w===e,onPress:()=>k(e)},e))}),(0,p.jsxs)(t.default,{testID:"gp-summary",accessible:!0,accessibilityLabel:L,accessibilityLiveRegion:"polite",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(r.T,{size:30,weight:"bold",center:!0,colour:m,children:null!=M.menu?`${M.menu.toFixed(1)}%`:'\u2014'}),(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:L.replace(/^Menu GP now [\d.]+ percent, ?/,'').replace(/\.$/,'')||'Menu GP'})]}),(0,p.jsx)(t.default,{testID:"gp-chart",onLayout:b?void 0:e=>D(Math.floor(e.nativeEvent.layout.width)),importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{width:'100%',height:F,alignItems:'center'},children:S?(0,p.jsxs)(l.default,{width:S.width,height:F,children:[S.yTicks.map(e=>(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:e.y,y2:e.y,stroke:c.colours.border,strokeWidth:1},`g${e.v}`)),S.yTicks.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:u.GP_LEFT_BAND-6,y:e.y+4,fontSize:12,fill:c.colours.muted,textAnchor:"end",children:`${e.v}%`},`y${e.v}`)),null!=S.target?(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:S.target,y2:S.target,stroke:y,strokeDasharray:"4 4",strokeWidth:1}):null,S.area?(0,p.jsx)(i.Path,{d:S.area,fill:y,fillOpacity:.18}):null,S.dishPaths.map((e,s)=>(0,p.jsx)(i.Path,{d:e.d,stroke:x,strokeWidth:2,strokeDasharray:f[s]||void 0,fill:"none"},e.id)),S.menuPath?(0,p.jsx)(i.Path,{d:S.menuPath,stroke:m,strokeWidth:3,fill:"none"}):null,S.menuDots.map((e,s)=>(0,p.jsx)(i.Circle,{cx:e.x,cy:e.y,r:3,fill:m},s)),G.markers.map((e,s)=>{const t=S.xOfWeek(e.week);if(null==t)return null;const l=F-u.GP_AXIS_BAND-2;return(0,p.jsx)(i.Polygon,{points:`${t-5},${l} ${t+5},${l} ${t},${l-8}`,fill:y},`${e.id}${s}`)}),S.xLabels.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:e.x,y:234,fontSize:12,fill:c.colours.muted,textAnchor:"middle",children:e.text},e.text+e.x))]}):null}),(0,p.jsxs)(r.Row,{wrap:!0,gap:12,style:{justifyContent:'center'},children:[(0,p.jsx)(j,{colour:m,label:"Menu GP"}),C.map((e,s)=>(0,p.jsx)(j,{colour:x,dash:f[s],label:z(e)},e)),(0,p.jsx)(j,{colour:y,label:"Delivery changed costs",tri:!0})]}),T.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:"Dishes on the chart (up to 3)"}),(0,p.jsx)(r.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:T.slice(0,12).map(e=>(0,p.jsx)(h.Pick,{testID:`gp-dish-${e.id}`,label:`${e.name} ${e.gp.toFixed(0)}%`,accessibilityLabel:`${e.name}, GP ${e.gp.toFixed(1)} percent${Math.abs(e.ch)>=.05?`, ${e.ch>0?'up':'down'} ${Math.abs(e.ch).toFixed(1)} points over ${a.RANGE_SAID[w]}`:', steady'}. ${C.includes(e.id)?'On the chart':'Tap to add to the chart'}`,selected:C.includes(e.id),onPress:()=>{return s=e.id,I(C.includes(s)?C.filter(e=>e!==s):[...C,s].slice(-3));var s}},e.id))})]}):(0,p.jsx)(r.Muted,{center:!0,children:"Cost your recipe cards to see dish GP here."}),G.markers.length?(0,p.jsxs)(t.default,{testID:"gp-markers",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,weight:"semibold",children:"Deliveries that changed costs"}),G.markers.slice(-5).reverse().map(e=>(0,p.jsxs)(r.T,{size:c.font.small,center:!0,colour:null!=e.change&&e.change<-.05?c.colours.amber:c.colours.muted,children:[e.date.split('-').reverse().join('/')," \xb7 ",e.supplier||'Supplier',null!=e.change?` \xb7 menu GP ${e.change>0?'+':''}${e.change.toFixed(1)} pts`:'']},e.id))]}):null]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=_r(_d[2]),l=e(i),r=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const m=c.colours.gold,x='#C9CCD1',y='#B0773B',f=['','6 4','2 4'];function j({colour:e,label:s,tri:n,dash:o}){return(0,p.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:6},accessible:!1,children:[(0,p.jsx)(l.default,{width:18,height:12,children:n?(0,p.jsx)(i.Polygon,{points:"4,11 14,11 9,2",fill:e}):(0,p.jsx)(i.Line,{x1:0,x2:18,y1:6,y2:6,stroke:e,strokeWidth:3,strokeDasharray:o||void 0})}),(0,p.jsx)(r.T,{size:c.font.small,colour:c.colours.muted,children:s})]})}},1180,[17,85,780,777,905,858,908,804,889,1157,1181,8]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GP_AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GP_LEFT_BAND",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelW",{enumerable:!0,get:function(){return u}}),e.gpChartLayout=function(h,i,o,c,s){const d=Math.max(10,h-n-l),M=Math.max(10,i-t-a-12),f=o.flatMap(t=>[t.menu,...c.map(n=>t.dishes[n])]).filter(t=>null!=t),x=s.length?Math.round(s.reduce((t,n)=>t+n,0)/s.length):null;null!=x&&f.push(x);let p=f.length?5*Math.floor(Math.min(...f)/5)-5:50,b=f.length?5*Math.ceil(Math.max(...f)/5)+5:80;p=Math.max(0,p),b=Math.min(100,Math.max(b,p+10));const $=Math.max(1,o.length-1),y=t=>n+t/$*d,P=t=>a+M-(t-p)/(b-p)*M,_=b-p>30?10:5,F=[];for(let t=p;t<=b;t+=_)F.push({v:t,y:P(t)});const L=t=>{let n='',l=!1;return o.forEach((a,u)=>{const h=t(a);null!=h?(n+=`${l?'L':'M'}${y(u).toFixed(1)},${P(h).toFixed(1)}`,l=!0):l=!1}),n||null},w=L(t=>t.menu),O=o.findIndex(t=>null!=t.menu);let j=-1;o.forEach((t,n)=>{null!=t.menu&&(j=n)});const k=O>=0&&o.slice(O,j+1).every(t=>null!=t.menu),v=w&&k&&j>O?`${w}L${y(j).toFixed(1)},${P(p).toFixed(1)}L${y(O).toFixed(1)},${P(p).toFixed(1)}Z`:null,A=o.map((t,n)=>null!=t.menu?{x:y(n),y:P(t.menu)}:null).filter(t=>!!t),D=t=>`${t.slice(8,10)}/${t.slice(5,7)}`,E=u('00/00'),B=Math.max(2,Math.floor(d/(E+12))+1),G=Math.max(1,Math.ceil(o.length/B)),I=[];for(let t=o.length-1;t>=0;t-=G){const n=Math.min(h-E/2-2,Math.max(36+E/2,y(t)));I.some(t=>Math.abs(t.x-n)[t.week,n]));return{width:h,height:i,yTicks:F,menuPath:w,area:v,menuDots:A,xLabels:I,target:null!=x&&x>=p&&x<=b?P(x):null,dishPaths:c.map(t=>({id:t,d:L(n=>n.dishes[t])})).filter(t=>!!t.d),xOfWeek:t=>{const n=N.get(t);return null==n?null:y(n)}}};const t=24,n=40,l=10,a=12,u=(t,n=12)=>Math.ceil(t.length*n*.62)},1181,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,1185,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1184,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1185,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1186,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1186,[17,777,858,1187,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1187,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1188,[812,1033,1183,17,1189,219,385,409,85,1191,1192,1193,777,816,876,851,1034,804,889,1199,1184,1057,1035,1194,856,1195,1200,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1189,[17,385,85,1190,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1190,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1191,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1192,[17,85,777,812,876,851,1191,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1193,[812,1191,17,385,85,777,884,876,1071,863,804,1184,1057,1194,856,1195,1192,1196,1198,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1194,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1195,[17,85,777,876,1008,1033,1064,1062,1194,804,856,1193,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1196,[1034,1197]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1197,[1034,1191]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1198,[17,85,777,812,1033,1034,1196,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1199,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1197,1034,1201,1097,804,1188,1057,1051,1191,1196,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1185,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1186,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1187,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1187,[17,777,858,1188,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1188,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1189,[812,1033,1183,17,1190,219,385,409,85,1192,1193,1194,777,816,876,851,1034,804,889,1185,1184,1057,1035,1195,856,1196,1200,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1190,[17,385,85,1191,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1191,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1192,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1193,[17,85,777,812,876,851,1192,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1194,[812,1192,17,385,85,777,884,876,1071,863,804,1184,1057,1195,856,1196,1193,1197,1199,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1195,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1196,[17,85,777,876,1008,1033,1064,1062,1195,804,856,1194,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1197,[1034,1198]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1198,[1034,1192]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1199,[17,85,777,812,1033,1034,1197,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1198,1034,1201,1097,804,1189,1057,1051,1192,1197,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1201,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1193,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1196,1198,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1194,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1197,1199,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1203,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1204,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1205,[17,85,777,876,1059,804,1071,8]); @@ -1326,9 +1326,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1243,[824,1244,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1244,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1245,[17,856,1242]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1191,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1247,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1187,848,995,998,1076,1107,1251,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1188,848,995,998,1076,1107,1251,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1249,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1250,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1251,[17,385,85,862,863,1033,1252,804,777,779,8]); @@ -1359,7 +1359,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1276,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1277,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1278,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1191,8]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1280,[17,85,1281,777,858,920,1260,1263,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},1281,[17,85,1282,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1282,[1283]); @@ -1420,7 +1420,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1186,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1480,7 +1480,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1190,1172,385,85,995,998,862,863,804,777,1401,1404,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); @@ -1499,13 +1499,13 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1194,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1191,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1187,1405,862,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1188,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); @@ -1513,8 +1513,8 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1186,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1194,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1189,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1188,926,927,876,1442,1395,998,1443,1005,1142,892,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

${i(o)} \xb7 ${c.label} \xb7 cut along the dashed lines \xb7 print at 100% (actual size, not "fit to page")

${u.join('')}`}},1437,[843,1285]); @@ -1533,7 +1533,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMo __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1189,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); @@ -1555,7 +1555,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esMo __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1191,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); __d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); @@ -1563,13 +1563,13 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1186,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1187,853,1184,884,1361,998,843,1115,1185,1206,1071,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1194,1486,1509,1457,1510,1511,17,1185,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1189,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1191,1485,1057,8,260]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); __d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); @@ -1591,7 +1591,7 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours and paydays, and the team tips pot). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); __d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); @@ -1635,7 +1635,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.UseOnComputerPage=function(){const[e,n]=(0,o.useState)(null),[f,y]=(0,o.useState)(''),[b,x]=(0,o.useState)(!1);return(0,p.jsxs)(t.default,{style:{gap:12},testID:"use-on-computer",children:[(0,p.jsx)(r.T,{weight:"semibold",center:!1,children:"CoverCharge for desktop, for owners on a Mac or PC"}),(0,p.jsx)(r.Muted,{center:!1,children:"The same account, bookings and permissions as this phone, on a big screen: wide booking and hours tables you can sort, filter and download, and larger takings and GP charts."}),(0,p.jsxs)(t.default,{style:{gap:4},children:[(0,p.jsx)(r.T,{size:14,center:!1,children:"1. On the computer, open Chrome, Edge or Safari and go to the CoverCharge website\u2019s /desktop page."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"2. Here, tap Make a sign-in link, then Share or copy it to yourself."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"3. Open the link on the computer, or type the code into the sign-in box."})]}),(0,p.jsx)(r.Muted,{center:!1,children:"The link works once, for 10 minutes. This phone stays signed in, and your personal link isn\u2019t changed."}),(0,p.jsx)(r.Button,{label:b?'Making a link\u2026':e?'Make a new sign-in link':'Make a sign-in link',disabled:b,onPress:async()=>{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1189,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); @@ -1665,7 +1665,7 @@ __d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); __d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1189,1458,1202,1185,1483,1186,878,1212,1213,884,776,899,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); diff --git a/car-app/index.html b/car-app/index.html index b06159410df521aab82e3ef94dd64ca033aca729..ddc8b48ca28be038957c7f5614c795d59579cb6b 100644 --- a/car-app/index.html +++ b/car-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/owner.html b/car-app/owner.html index db8aa030da1f7257022d32f4dc3b2d7a75d82121..582916de34ca731e94d4008d7889104ed85aaf99 100644 --- a/car-app/owner.html +++ b/car-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/sw.js b/car-app/sw.js index d14383227ee60cad2768b809c81ae9d56be0e3c9..c9bd4a7cfeb4a4dd6b8b8795a3772f847249f13e 100644 --- a/car-app/sw.js +++ b/car-app/sw.js @@ -1,7 +1,7 @@ // Anchorage car screen service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-car-331ba98185"; +const V = "cc-car-2fd5243fdd"; const BASE = "/car-app/"; -const PRECACHE = ["/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=331ba981856105282282edaea8b266b1eb4130ceb0d045e71bbc065965b50cdf"]; +const PRECACHE = ["/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=2fd5243fddc43e288b36012ccd137d7255746e7687fcd009e056c4c90ac1ea93"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/_expo/static/js/web/bundle.js b/chef-app/_expo/static/js/web/bundle.js index 1ecf51297aef100db075b72355f1e2bc6283116a..1e2ce843c22e865fc5ed60e4b39cea9f50c78fd9 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1185,1188,1199,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1186,1189,1185,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1262,27 +1262,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_DELIVERY_NOTE",{enumerable:!0,get:function(){return t}});const t=null},1179,[]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpOverTime=function({rid:e,width:b}){const $=(0,n.useGpCalcView)(),P=(0,o.useRecipeCards)(e),[w,k]=(0,s.useState)('3m'),[v,D]=(0,s.useState)(b??0),_=(0,s.useMemo)(()=>P.map(e=>({id:e.id,dish:e.dish,price:e.price})),[P]),M=(0,s.useMemo)(()=>(0,a.menuGp)($.ingredients,$.cardCosts??{},_,$.settings),[$.ingredients,$.cardCosts,_,$.settings]),G=(0,s.useMemo)(()=>(0,a.gpHistory)(Object.values($.deliveries??{}),M,w),[$.deliveries,M,w]),T=(0,s.useMemo)(()=>M.dishes.map(e=>{const s=G.points.find(s=>null!=s.dishes[e.id])?.dishes[e.id];return{...e,ch:null!=s?e.gp-s:0}}).sort((e,s)=>Math.abs(s.ch)-Math.abs(e.ch)),[M.dishes,G.points]),[A,I]=(0,s.useState)(null),C=(A??T.slice(0,3).map(e=>e.id)).filter(e=>T.some(s=>s.id===e)).slice(0,3),L=(0,a.gpSummary)(G.points,w),F=240,S=(0,s.useMemo)(()=>v>0?(0,u.gpChartLayout)(v,F,G.points,C,M.dishes.map(e=>e.target)):null,[v,G.points,C,M.dishes]),z=e=>M.dishes.find(s=>s.id===e)?.name??G.names[e]??'Dish';return(0,p.jsxs)(d.Box,{testID:"gp-over-time",children:[(0,p.jsx)(r.T,{size:20,weight:"bold",center:!0,colour:c.colours.gold,accessibilityRole:"header",children:"GP over time"}),(0,p.jsx)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['4w','3m','12m'].map(e=>(0,p.jsx)(h.Pick,{testID:`gp-range-${e}`,label:a.RANGE_SAID[e],accessibilityLabel:`Show ${a.RANGE_SAID[e]}`,selected:w===e,onPress:()=>k(e)},e))}),(0,p.jsxs)(t.default,{testID:"gp-summary",accessible:!0,accessibilityLabel:L,accessibilityLiveRegion:"polite",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(r.T,{size:30,weight:"bold",center:!0,colour:m,children:null!=M.menu?`${M.menu.toFixed(1)}%`:'\u2014'}),(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:L.replace(/^Menu GP now [\d.]+ percent, ?/,'').replace(/\.$/,'')||'Menu GP'})]}),(0,p.jsx)(t.default,{testID:"gp-chart",onLayout:b?void 0:e=>D(Math.floor(e.nativeEvent.layout.width)),importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{width:'100%',height:F,alignItems:'center'},children:S?(0,p.jsxs)(l.default,{width:S.width,height:F,children:[S.yTicks.map(e=>(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:e.y,y2:e.y,stroke:c.colours.border,strokeWidth:1},`g${e.v}`)),S.yTicks.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:u.GP_LEFT_BAND-6,y:e.y+4,fontSize:12,fill:c.colours.muted,textAnchor:"end",children:`${e.v}%`},`y${e.v}`)),null!=S.target?(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:S.target,y2:S.target,stroke:y,strokeDasharray:"4 4",strokeWidth:1}):null,S.area?(0,p.jsx)(i.Path,{d:S.area,fill:y,fillOpacity:.18}):null,S.dishPaths.map((e,s)=>(0,p.jsx)(i.Path,{d:e.d,stroke:x,strokeWidth:2,strokeDasharray:f[s]||void 0,fill:"none"},e.id)),S.menuPath?(0,p.jsx)(i.Path,{d:S.menuPath,stroke:m,strokeWidth:3,fill:"none"}):null,S.menuDots.map((e,s)=>(0,p.jsx)(i.Circle,{cx:e.x,cy:e.y,r:3,fill:m},s)),G.markers.map((e,s)=>{const t=S.xOfWeek(e.week);if(null==t)return null;const l=F-u.GP_AXIS_BAND-2;return(0,p.jsx)(i.Polygon,{points:`${t-5},${l} ${t+5},${l} ${t},${l-8}`,fill:y},`${e.id}${s}`)}),S.xLabels.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:e.x,y:234,fontSize:12,fill:c.colours.muted,textAnchor:"middle",children:e.text},e.text+e.x))]}):null}),(0,p.jsxs)(r.Row,{wrap:!0,gap:12,style:{justifyContent:'center'},children:[(0,p.jsx)(j,{colour:m,label:"Menu GP"}),C.map((e,s)=>(0,p.jsx)(j,{colour:x,dash:f[s],label:z(e)},e)),(0,p.jsx)(j,{colour:y,label:"Delivery changed costs",tri:!0})]}),T.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:"Dishes on the chart (up to 3)"}),(0,p.jsx)(r.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:T.slice(0,12).map(e=>(0,p.jsx)(h.Pick,{testID:`gp-dish-${e.id}`,label:`${e.name} ${e.gp.toFixed(0)}%`,accessibilityLabel:`${e.name}, GP ${e.gp.toFixed(1)} percent${Math.abs(e.ch)>=.05?`, ${e.ch>0?'up':'down'} ${Math.abs(e.ch).toFixed(1)} points over ${a.RANGE_SAID[w]}`:', steady'}. ${C.includes(e.id)?'On the chart':'Tap to add to the chart'}`,selected:C.includes(e.id),onPress:()=>{return s=e.id,I(C.includes(s)?C.filter(e=>e!==s):[...C,s].slice(-3));var s}},e.id))})]}):(0,p.jsx)(r.Muted,{center:!0,children:"Cost your recipe cards to see dish GP here."}),G.markers.length?(0,p.jsxs)(t.default,{testID:"gp-markers",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,weight:"semibold",children:"Deliveries that changed costs"}),G.markers.slice(-5).reverse().map(e=>(0,p.jsxs)(r.T,{size:c.font.small,center:!0,colour:null!=e.change&&e.change<-.05?c.colours.amber:c.colours.muted,children:[e.date.split('-').reverse().join('/')," \xb7 ",e.supplier||'Supplier',null!=e.change?` \xb7 menu GP ${e.change>0?'+':''}${e.change.toFixed(1)} pts`:'']},e.id))]}):null]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=_r(_d[2]),l=e(i),r=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const m=c.colours.gold,x='#C9CCD1',y='#B0773B',f=['','6 4','2 4'];function j({colour:e,label:s,tri:n,dash:o}){return(0,p.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:6},accessible:!1,children:[(0,p.jsx)(l.default,{width:18,height:12,children:n?(0,p.jsx)(i.Polygon,{points:"4,11 14,11 9,2",fill:e}):(0,p.jsx)(i.Line,{x1:0,x2:18,y1:6,y2:6,stroke:e,strokeWidth:3,strokeDasharray:o||void 0})}),(0,p.jsx)(r.T,{size:c.font.small,colour:c.colours.muted,children:s})]})}},1180,[17,85,780,777,905,858,908,804,889,1157,1181,8]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GP_AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GP_LEFT_BAND",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelW",{enumerable:!0,get:function(){return u}}),e.gpChartLayout=function(h,i,o,c,s){const d=Math.max(10,h-n-l),M=Math.max(10,i-t-a-12),f=o.flatMap(t=>[t.menu,...c.map(n=>t.dishes[n])]).filter(t=>null!=t),x=s.length?Math.round(s.reduce((t,n)=>t+n,0)/s.length):null;null!=x&&f.push(x);let p=f.length?5*Math.floor(Math.min(...f)/5)-5:50,b=f.length?5*Math.ceil(Math.max(...f)/5)+5:80;p=Math.max(0,p),b=Math.min(100,Math.max(b,p+10));const $=Math.max(1,o.length-1),y=t=>n+t/$*d,P=t=>a+M-(t-p)/(b-p)*M,_=b-p>30?10:5,F=[];for(let t=p;t<=b;t+=_)F.push({v:t,y:P(t)});const L=t=>{let n='',l=!1;return o.forEach((a,u)=>{const h=t(a);null!=h?(n+=`${l?'L':'M'}${y(u).toFixed(1)},${P(h).toFixed(1)}`,l=!0):l=!1}),n||null},w=L(t=>t.menu),O=o.findIndex(t=>null!=t.menu);let j=-1;o.forEach((t,n)=>{null!=t.menu&&(j=n)});const k=O>=0&&o.slice(O,j+1).every(t=>null!=t.menu),v=w&&k&&j>O?`${w}L${y(j).toFixed(1)},${P(p).toFixed(1)}L${y(O).toFixed(1)},${P(p).toFixed(1)}Z`:null,A=o.map((t,n)=>null!=t.menu?{x:y(n),y:P(t.menu)}:null).filter(t=>!!t),D=t=>`${t.slice(8,10)}/${t.slice(5,7)}`,E=u('00/00'),B=Math.max(2,Math.floor(d/(E+12))+1),G=Math.max(1,Math.ceil(o.length/B)),I=[];for(let t=o.length-1;t>=0;t-=G){const n=Math.min(h-E/2-2,Math.max(36+E/2,y(t)));I.some(t=>Math.abs(t.x-n)[t.week,n]));return{width:h,height:i,yTicks:F,menuPath:w,area:v,menuDots:A,xLabels:I,target:null!=x&&x>=p&&x<=b?P(x):null,dishPaths:c.map(t=>({id:t,d:L(n=>n.dishes[t])})).filter(t=>!!t.d),xOfWeek:t=>{const n=N.get(t);return null==n?null:y(n)}}};const t=24,n=40,l=10,a=12,u=(t,n=12)=>Math.ceil(t.length*n*.62)},1181,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,1185,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1184,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1185,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1186,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1186,[17,777,858,1187,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1187,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1188,[812,1033,1183,17,1189,219,385,409,85,1191,1192,1193,777,816,876,851,1034,804,889,1199,1184,1057,1035,1194,856,1195,1200,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1189,[17,385,85,1190,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1190,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1191,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1192,[17,85,777,812,876,851,1191,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1193,[812,1191,17,385,85,777,884,876,1071,863,804,1184,1057,1194,856,1195,1192,1196,1198,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1194,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1195,[17,85,777,876,1008,1033,1064,1062,1194,804,856,1193,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1196,[1034,1197]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1197,[1034,1191]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1198,[17,85,777,812,1033,1034,1196,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1199,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1197,1034,1201,1097,804,1188,1057,1051,1191,1196,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1185,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1186,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1187,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1187,[17,777,858,1188,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1188,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1189,[812,1033,1183,17,1190,219,385,409,85,1192,1193,1194,777,816,876,851,1034,804,889,1185,1184,1057,1035,1195,856,1196,1200,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1190,[17,385,85,1191,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1191,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1192,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1193,[17,85,777,812,876,851,1192,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1194,[812,1192,17,385,85,777,884,876,1071,863,804,1184,1057,1195,856,1196,1193,1197,1199,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1195,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1196,[17,85,777,876,1008,1033,1064,1062,1195,804,856,1194,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1197,[1034,1198]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1198,[1034,1192]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1199,[17,85,777,812,1033,1034,1197,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1198,1034,1201,1097,804,1189,1057,1051,1192,1197,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1201,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1193,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1196,1198,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1194,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1197,1199,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1203,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1204,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1205,[17,85,777,876,1059,804,1071,8]); @@ -1326,9 +1326,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1243,[824,1244,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1244,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1245,[17,856,1242]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1191,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1247,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1187,848,995,998,1076,1107,1251,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1188,848,995,998,1076,1107,1251,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1249,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1250,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1251,[17,385,85,862,863,1033,1252,804,777,779,8]); @@ -1359,7 +1359,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1276,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1277,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1278,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1191,8]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1280,[17,85,1281,777,858,920,1260,1263,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},1281,[17,85,1282,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1282,[1283]); @@ -1420,7 +1420,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1186,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1480,7 +1480,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1190,1172,385,85,995,998,862,863,804,777,1401,1404,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); @@ -1500,7 +1500,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1418,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1419,[13,17,856,1420,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1420,[1421,1425,813,912,1072,1426,1209,1210,1028,1025,1026,1427,1429,1432,1153,891,978,1434,975,880,1031,1032,1435,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1436,1066,1084,1086,1081,1027,1010,1057,1443,1444,1445,1453,1454,920,219,1246,1182,1188,1450,1202,1199,1459,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1420,[1421,1425,813,912,1072,1426,1209,1210,1028,1025,1026,1427,1429,1432,1153,891,978,1434,975,880,1031,1032,1435,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1436,1066,1084,1086,1081,1027,1010,1057,1443,1444,1445,1453,1454,920,219,1246,1182,1189,1450,1202,1185,1459,1186,878,1212,1213,884,776,899,8]); __d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1421,[812,17,1018,378,85,1108,1109,1367,1400,777,995,998,863,804,1057,999,1422,1423,1020,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1422,[812,17,385,85,777,804,998,805,999,856,899,8]); __d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1423,[17,85,777,998,1424,842,804,1038,928,8]); @@ -1516,11 +1516,11 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1433,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1434,[219,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1435,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1436,[805,1433,1095,1270,1437,812,822,1117,1118,1091,1122,1438,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1440,1241,1441,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1442,1232,899,1186,1405,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1436,[805,1433,1095,1270,1437,812,822,1117,1118,1091,1122,1438,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1440,1241,1441,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1442,1232,899,1187,1405,862,8]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1437,[806,17,85,777,899,1274,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1438,[17,385,85,1439,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1439,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1440,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1440,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1188,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1441,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1442,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1443,[17,1401,1057,8]); @@ -1539,10 +1539,10 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1456,[17,278,85,777,857,804,1457,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1457,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1458,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1459,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1447,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1459,[1186,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1447,1162,860,1187,853,1184,884,1361,998,843,1115,1185,1206,1071,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1460,[13,17,856,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1461,[1462,899,778,1414,1464,995,13,1491,479,17,368,319,219,24,85,805,857,1065,856,1493,19,858,998,876,804,1454,920,988,1496,1497,1028,1104,880,1008,914,1499,1384,8,1500,1501,1502,1503]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1462,[880,812,17,219,366,85,777,1463,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1462,[880,812,17,219,366,85,777,1463,899,804,1189,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1463,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1464,[1465,1488,1490]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1465,[198,1466,1469,1483,1484,1485,1486,1487]); diff --git a/chef-app/admin.html b/chef-app/admin.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/admin.html +++ b/chef-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer.html b/chef-app/customer.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer.html +++ b/chef-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage.html b/chef-app/customer/anchorage.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage.html +++ b/chef-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/book.html b/chef-app/customer/anchorage/book.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/book.html +++ b/chef-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/feedback.html b/chef-app/customer/anchorage/feedback.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/feedback.html +++ b/chef-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/gift.html b/chef-app/customer/anchorage/gift.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/gift.html +++ b/chef-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/lost.html b/chef-app/customer/anchorage/lost.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/lost.html +++ b/chef-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/loyalty.html b/chef-app/customer/anchorage/loyalty.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/loyalty.html +++ b/chef-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/merch.html b/chef-app/customer/anchorage/merch.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/merch.html +++ b/chef-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/offers.html b/chef-app/customer/anchorage/offers.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/offers.html +++ b/chef-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/refer.html b/chef-app/customer/anchorage/refer.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/refer.html +++ b/chef-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/waitlist.html b/chef-app/customer/anchorage/waitlist.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/waitlist.html +++ b/chef-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/whatson.html b/chef-app/customer/anchorage/whatson.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/anchorage/whatson.html +++ b/chef-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/basket.html b/chef-app/customer/basket.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/basket.html +++ b/chef-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/profile.html b/chef-app/customer/profile.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/customer/profile.html +++ b/chef-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/demo.html b/chef-app/demo.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/demo.html +++ b/chef-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/display.html b/chef-app/display.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/display.html +++ b/chef-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/index.html b/chef-app/index.html index 302c57bf92bc1a57a433a98c7adbab4b3214216a..9eaa5f7321ca4d3e57f530c1c185915b0ce1a750 100644 --- a/chef-app/index.html +++ b/chef-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/kitchen.html b/chef-app/kitchen.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/kitchen.html +++ b/chef-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/owner.html b/chef-app/owner.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/owner.html +++ b/chef-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/staff.html b/chef-app/staff.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/staff.html +++ b/chef-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/sw.js b/chef-app/sw.js index bd1b00f7223bc3dfab744a34f4dd7c71645a858c..7b400b337b4e5d09c91b5e93250babdee6203ebd 100644 --- a/chef-app/sw.js +++ b/chef-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Head Chef service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-chef-0740d866b1"; +const V = "cc-chef-f22ed7ed0c"; const BASE = "/chef-app/"; -const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=0740d866b15dea317e08ff18834c25e168985fde9d0c2d44517490482ad6411b"]; +const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=f22ed7ed0c6a3a6a5ca3f1b67cd4e98026bca0f671c470f1c4e3573d52e5bf95"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/team.html b/chef-app/team.html index 126f61dc5b896801c00d002b3d1eb9391604af17..f160a96f9de662453ace07ce65838c96f0dbfba2 100644 --- a/chef-app/team.html +++ b/chef-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/_expo/static/js/web/bundle.js b/customer-app/_expo/static/js/web/bundle.js index 9a3caef9ae82ace46f5d19b77f1fdcb05d8c2641..c023dee84120948ad400e6d95607046b5e8e19e9 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1179,1182,1193,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1208,1209,1218,1211,1155,1220,1224,1197,858,1153,899,1225,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1180,1183,1179,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1208,1209,1218,1211,1155,1220,1224,1197,858,1153,899,1225,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1256,27 +1256,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STOCK_ICON_IMAGES",{enumerable:!0,get:function(){return A}});const A={'\ud83e\udd9e':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAABACAYAAACKhS4jAAAZTUlEQVR42rV6eXxcxZXud6ruvb2r1ZJarW6ttpGxZeMlZjWLbTBbgIQQZIckjxAYYHgEQjIJPDKZkc2E/DIhCZM3GSCQeQSSEAaxOazBBmwcbGyQF+IN28KLrM3ae1N331t15o/uNrItOWbycn+/+2vLt27VV+d+56tzThXwV1zPAJLzt2BAtgDiBM2p0JYKt2BAFh8yQADwy1Co7s9V0cc3RaI/uwehYOGZOGlQYzoXJ2oz3v9PNAGa4M9iP28DBgCsKQ9/h+samGsbuCsSe/2HgUD5RP0a41mTAJXvd0ILggB+uaJiXgTG5QlwdYCw/eVk/Pnlo6NdLYBYDuhi+xaAlgP0UlnF1xpM4yof4BtmdPRp5wnq738HAPUVxhti1Z5VyhGAjlrmpdfB91+bE8GrluFQdhlANBGu4uz+saRkyoGq6t92RKK/bgL8Y61V/BprKyvvGqmpTXDdJOa6Bua6Bu6sim17vLx8Go1pV/xdHw4v59p65tp6TsZqmOsaOB6rTb8cLF9UaCcB4I4ylPTFqj/WNXWcjdVkubaet4Yjj4xpQ+PyFwDu94VmdkWrP+K6Bk7GavhmT8kZxYkxIAjAy6GKK9LVtcw19by3MvrS2nDk/uForJ3rJ/HOyuhzCwCDAVE0xu8rKqbGq2tSo7G6dFtF5bf/3Rc6bXck9iTXNXB7VfTxIrDiBNrCkfu4po6zsVrbrq51cjV1vDkc+fpYeh1lcQJwg9tduz8S28G19czVtU4iVnPgSkS9Y/0AAPVEY6u5toG3lEf+pUi9p4LBuSPR6s5MrDb7pLd0duEdEwB+H6q4hWsb+EA0+svimHdY/qZkdW1yqLpu4wLAXaCjyYB4saysaShW06er6zhTXeNwTZ3uj1Z3/UswOInBdIT/BVDyDsC1NxJdwbX1nInVZLiugbdWRp8stDGaC1a5ze+fnohVp/tj1W0AXBLAvvp6NwDsicQe5LoGfjUU/k7hPQsAuiOxR+zaOn4jHL6mMJ4BgHLVtR8djFZ3zwdixzJhdyTyBNfWc7a61snFamyuqecPw1WPjqWYQN7q6vNl4ZsnmebnHK0cQSRZawit13DeSZxnClz7fiAw1SsNz66s8woBWQcw3j9wwGZA7HCyq3Na43yPaxYAoKkJAFBlmmVJzc5rqVR7weGYADYBxYBMAbS2LhjaXFn1zN5I1WMA8LGt/5DTGhIQIBIazNWmsfTRUGiGKLwnCFB3+P3hWS7zOwIEzSCTyBhQamilSr5HAD8cCDQ2FOgRgfQJIgRN2sMArQbQnAejX8rldmY0RnNANQBgxwwFAP3slEogU+/SQwDQWpCyEa21JMJWYEhn3XPnuF3NUyzX371fEb3pssG+V1JadUkiYoAUsy6TsuR8y7qzIDcsAOAmr/eLFdKoz7HWRFSgE3307aHUnl2V0R8vDZavfjlc9XUA6NO2SzMjTNQDgBcWLAkAP/P7B0uEGBphXQkgALRqALA1mwDBHnUfpRTrnNFlCVbfB5Ae1bompbQNZl1r0M0AnC7Nq0ACAGsAAsxcLYzmB4PBBgK0aAGMkJBX5CdYAEIChxz7zR8EAp9pNI3vhgixMikXAUAf86t/SCWufUDrdQX9LOo52tJpx4EeFQwXCs5a4OZR2ry98Pdn+wafnd7d/SgAKAVIgqGYOSDknMeCFbMrhHxRg0H5L0s2sw4YRuhCy70EAER9IDCp1DBmQ2sigMBMAKPOEG03+nxXCSEYrPWI1mEArlmHD/d+YXDwuZ/29qaKiyQVnGfRyMhon+P0uwCPHxDGGNAMCIeZjpXnbQWnNoXs1wzNzMorhetyj7Hw/w3G/zzoOFmDhKGLfTGjxjCv+VEoFBSmlNOV0lWaCAyQIBJZrfBSJnPYQ3JyYVEQLkLoPMDL+RXTOHax4E9WXzaBirsDgdCRJRaCLUL6glJ3GgCWFZovAdSO/GoON0ELQDNAIIJN8szNlMuRED1UWNEZEApgizB7qsR8caU7MCUopam0VgAgiSjNnFqRydjDmo9ImIfIf4HH4yWAl50gfChOwiiEEQBMm+F1E2Xmu1z2se2bC6+cZtBhi5DTgMHMcDRPnupySQmMgrlIP9Jaa78Q7jmm91yRgKoTeasfuRymzA5HZASxCwAcgEulKPlKWZm3YDmaMHQs9vHJP4M2uAxgjjvOccHVssLv8+n0cL+jMxYJIs2IkpjkSguvDyIFoiN2YQKYCCOaZ4oBrfOyRgWdYYYL7LvYizIH5DAAh1mbRCWnELnHDjgBfE3Hf4yJgjwsL/jMTSMjAyOsD4EImw3F73tVWaBGPL3eyjU5+dCzMHESlMc4WSjm0NiRHYA9Qri/nPXmgowDxAQ3Q+eYrd+m05GCTh9redb5zjPdSnWUGIbrK75gyfjR8PFM0/k2I0EhOkYFY6tl6/2GokmWNbOEyVPgxVH9lAoKGx4SJWDOO2ve8HAkoasS9/QL1VgnbMRsIKwkBSCnA1jVfAIkDqAMIRAtUO6kruZmgdZWFRSi19KEq0ZNOCzgAasSkFBjgIv8goUKkpXCR6KqOC0GYBBoBBraIz+XtDB9vWljn9SCBOEit9VYGGxCHLLweR0QMyB8gCBoaAaPJMX49GltBQB8mM12EAPlLDhiavhZSOcTxz+Kh1KQMBJadYGMOjAzAaQAhLXARSlD28QkQeTTeREkiGhhsHFANBPQCgjuBQhusCgsYDmLyDWoVN8/xDtH6QQ82q3UnrmKQackBOqTwAcVQNzKB8s8BjiAUa3TIkccP17uGOVMokoJCiuCCSIQYVA71QDcMg+KJlCbJMA4JHR8RVnZ1y4zPNM0I+Vo6NaCph9n+MLvGYbY4RhOVkZSJH0OU00SUOIof2eABRG6lXNIBA3ZUVgCjrKmDcCm/K3zKy8MoOYrXm9In0g+mEyHGSnbvvFSt+/RR8tLn/QTxZjgYIL8thnQBODBdLprEHo/iAgKmiwFSF3Qo09GYCKkmTqFcnhjRisWRMfpdfHOOzKjQsiSezye4Phaf5gAoJZEvwChyXLfKQlmrWk2Bg0jlGF2Lh5TLThmLNbNkI+kUocHcliFnFEkwDjGYSYQSki0iTdTmXWjzH1Gnll6gs7JYYZHCHmay+8ZX+uTxACFpEwIMBzmHAPIMds678BiJZDTn2jD0YtVaz4C2zRkPZ4alhouGCyOZgMDLImQUk7uY5V9W/xnauijuHI2Ix9V6hPpsQJEO7N3vIdtBQs6di6UBSCYhcgnMobQihslZneGQhcWYhQ5zmKl+Z8hbrAPtu0bMB/I9VmMETeDCUxgDWhmtqUQchj6lYv6+98QbYC9x7F/o/IDjf+l8jOmDLPMaT1yrOUZEKejzd4QCEx902t84wshPz/kt4RghsGglZbBPyh1+dsD/kdfDgYnFzIhMc5ySwAw0GF8mFsXtnlfQDA5bDKRRSQsKa0ux974Qjb7DQE4BgNEAwOteyrNpae43VfllLLzcn9UYYgFCeqwc0/P6O3eXkgN9Vj3aAKsqMf74O/9wdgbhqXJpcXfp21oVvi5zyNWWl7VKey6uzP2/70AI1cf+5U5P6azJhy+/TOW9QuPozW7mIXpoXgqnRgF+hPgt3+UiH/vP1Op3hZAGMvyK2vuhWT8lhuk8VzYkPN1PqpzSEASiEgzA4xuZe8ZI7WqaHUC1MqKyptiLuuz52RHna1CG19K27A0Q4Fwvq2wTyrZlM2oetO84p5QxbU01P80FwpcHwAmAfZDvkjlTNP4Rz9JONMnwYiUaZgemezrX/2//7jq9hVAR7HasbygUChYkm+Bv+K7lYEfl5tySUhIH2wHjnbApsGGkJR01MirdvbCpf39m7cD5oy89fQNXm/lj0tDG8LarCNWOmlq4dcCDuVnmSWgQwg0KEeZwpBddu7td3u6L2vGPAbaFAH6X2vLY9dpz89qtV6qJtUqOWOa1NmcI1yWGEylnyt/qnUJNzVZ2LHDLlbNBMYE+o8i2d94uPvGjY594dpM+vbhmuh2MWcm5BmzQbObnIDLDFaxvJoAngnkCHAI0Hf5/ddVklGnqtPKrrSFR0nkCqRTyFegGh0FQEiltS4Rcr6rvPw8QptNgLG2vPLLfzdqrKl19FJbSk3RKkLOtgUgoFm829f1JgOidcYMNbbcZ4yRw3wW09ws6NlnN4J5455FCxtKS/1NyOYcGELi4EGeMZT42lC0unxn1u7MGMaGJ3h4e1nWuhhTs0zX90EeMqGeCEPYMl9jKwyVI4LIE137pXRNt6wl71VXp2tse3nU471EVJTDKfEr6fNAlAQkpBTDjpPsGRh47KF9vb++mkjr1tYTFW/HOFBzs3z8QPuCr0+f9iakhHYcjZ4+EgNDhNE0kEghnbOzI6T3WVkrWn5+Jqg/P8ximyTnmYpCyjx+piUAZICUth0jEC51oekUrf1BFoI0LJfZOzi0JeXYT7b1DLy/5N13//RJQHm0kxtjS80E8P1z5oR9LnkqtbauB/DWzMrK754SLLktaFmTRU0UOhaxoRUjnSFXT48R7eiZBlJgJw2xi0i3eYCsBNx6XN0l5DMhr1I+rijTas5MW5oGCa0NkJCd/X2t169Zf8dbhw/3Fl6xPvjsZXeWel03diRTNy56fdV7RYc9orWrWxZIAFhcWXHx/5o5Y23X0i8++/CcObPPfPn1nzy8fdPZu4aG707ncrYwTVNYLkuUBk05a6ZE06lQpAC3DfTmwANmnuQTJloEKAXl8UDMO03IgN+EIY1hrdNth/tbalpXXL+6r68XAH4ya9bc7iXXvDqvvuYBtzQOVcNoZ2YqJvDHFfl/MmtWeOmpU35dW1l+eWIkMbJnaPjn9/1p14MrRg4M/+6COY3nVNR+UxrG+W4gCMNQPJywQ1u2TTbP6DOpLAe1vgo8XJgAjw+etIbyuPTwrOkH06bVy05u/av7Ov/tG5s3Hyjm+xsuvfjmpkjFj2AI2j8wcO9pK17/eSFXOlKjP7Z8QQRwGPCvvOLS+6aFy7/lcrvRNxzfuS858pQWcm93Iq3jyp5UJq2QbRiZUDzuO7ej5zZzbp+PqjJQmyrAXT7AHJ82DLABUJLV6Nra6l/ud7s+rresnnK35ZJSWtlczpxSErw+GiyZ3x2Pv7Hq4MG7r39349Z8PEYYqzY03naNyM8Qqy684PJpFeX3VZeFTocs1PUFAVoDjgMQMTIZ0m+9D0zphGhMQ20PgveWTggeAKA1yOOBvOAswO8f4wz5F4ZG4iP7h4fv/cxLrz8MAG8vWGAsWrPmuHKLMV54ekQyW1tf+1p9/frbZ56yRGsx2dY6k7RtV9rRpW5BpSUuy/BLjtc7zjWlCXcpjDSTxyHWdKL9LjaEoCGt+nd2dDw35HB/1nGSlhBDAbeRnRoqH25tP7Dprra2g4IIT197rVzU2uqcxD7X0Vdhxs79MydF/N6y2QvDFdOrykrr+0Yz9YZGXZlp1JX7vSHxwTZTDXRDnD4M7vJCHygBTDUh59m2YUarkJh5arpnNNWeZT5Y4Q/sGU2lO984eHDzrXPPeAeLF+tlS5bw8hNEuhOCf6a5WS5tbVW/Pe+8BVdMqn4q6PXGII18ocJ28pVRzYMH7dxH1tad1ZGe4TrHK5gU04lMoiXYzDD1B717c2fNOVRtuuaCEITLBQgBKBvdA0Mvndn64tIO5syxPD8Z8MTMaCSy3lnyhXeiodCZB/r7V0Y87j+39fTvefHQga1rO3o+vmtqQ1mksuniUyObbq3amZzu7PVA+BWNW2oqpGSckNqckqGBM6ztyZ75j61o/3D3mr6hxI1TpsQW1EZnOIRrS0sCMzZ2HHrwrFfe+DY3N0tqbVUnDb74wrqLL7z1nMkNj+zvH1g56bkVlxSfv7V48aVTQv5rQl7XVQGrNKp9+5WqfovEyoDgLb582d8s7OQeSYoJsAHRmAV/vp9l8lSgbyHF7SFYmjf1ZJIrt/WPPL96f+f+e+efsarc7z9t9d7dNy9atfZXRfr+RfAMkCTif5o+veyOWU3rQ1533SMf7rqgOmDFG/zBr9b4PM3lPt+p8HqRjo8c3tk3vA4i6Ztz4XsLpVubue0ejTYPyW6LOG0cSYSpPAealwafnmI2CatWVT2Z6m5ad0Vj6YVDo8750WBJDNDY0tlz47q+wVXXTZ/ynt8wgu8c6Lh88VvvrOWWFkHLl+sTqg0WLJB6zRpnQXXll8rLS6fu7Tz846fa23tfuHTRB+Gy8jCyWfSn0zuHhwYfWtfdO3JOrPqWxlDFeTq1Cyz7YTZlhT4lw2JIgvtcQJqAcgWqzAJBAKMECYMWls9bMgR37pvvrVr26O6Bnr1XXDHFF/T++7RI5WP7U5m5T2zbtviGWXM2TA1XPPP3kchsLF/ex8dsIh+filVWMgB4TJHe19P7dOOLf/g/v1o4/6ZwqCzc2Xd408pDHV+e+ftnz4in7fQXpzb+R2O04rz9vc5LIzl+lbwSWkFJDxMmOaCzE6BFcdBpaaBMgxWzcDONZnVqNMsHomW+mx8+//KdHV+8+v43e3o+3HKg62YBnT03Fv7dtzZvb9/U1XVtfDT73pRIZFyn/UtFUDw+e3bp1TOmrrNMs/6VPXvOXbLu/S17r77qZ1NikW/F44mR7UO9P5z/yuoH1txuXTNvCj/ji0tW3ZYQ/Zp0wgRBAD4bVMrQZaRkbFTuGdTrp96vPrfukgWnR0pCd02uKL90V3fvL6avePmODZcv/ocz6+t/sqXj4H1zX1nZcsJ69EQPPrhlnjkveqVa/afVlyyc3PDart7DD03/w2u3L54cqvuvsy/aKpi6frNzz5fv3LJlqyDgiel1TdcEU+94M1Tu1DOLEpswZACDdj7ZA6BHpTJcJJPMvwm8O3R9kbrDX126gcHV33/rtRn/0ZUY7l56zYaAx33app4dNee/trl/Irmc8FTHvOiVipYv58ZI5U2jOVuv7u3+Nwbo/qnzGi3LFWyPj/zizi1btvKCBW7FoMZc8pBdFu/j8xLAZ0e0WJwALU5AzEhCTItDTIvDmDUENA5jtDTd1QIIvnKelwDno4GBp0rcnshXP3PeQgLUnsHENw8lU+/GPJOKuwbjXsaEgWves2lHIn44AOPu2zZs2XMbgE6ff7LfMKjG7dndAghUVtpg4GwaSGyaJdvnZtU02m2AXQIYApAeEwoDpA3GRie7bzmgr4rBZgAdfcMvzKyK/KDcZV7GwHMXrFz5LoCLMF70eBKWL34ivuSlP955zkuv/JSfeUYCQEcmPW0oHs8s/dPq9uWARmurxhIIQHDMoj/D0JADOabOHCidA1wMuAB2MeBmshV4a49vNwB8PNSmuaVFXPvBBwe6E4k19cGSK/mWW0xuaRF8EmV94y8eHGLWWLZMYPt2BoCQaTWZhuxc0ztysChdhT1GHE7znkjOBT1iEo+aQLZgG8EgjwKV2GQGM9lFdakObAWam45YVu0dTP6rMl3fXL17p/fWtrYRPgkx+YvgC5zTxc72jqSeP5hOpgv5ZL7+3JoHsWar5+OGgDcTcMGl3DkWZTZBaEATdMLS6PCLgXZv1yFyDwKHgOVgwnIGgMveeuttABtagEwxuv2rwY/hHQPAFW+//djYikNxj4oBejiW2qFnpOIwUEmjxOSIfH3dUJA1KcAPZA/J0bVrgg4XJ37kC4OkoPRyPhnCnDz4o2fS0iKwYwcVg6XCF9EE8GudwQVGVpaqlMWM/L4OlAAsBS2YDDfD5U/7SuoHQzSIeOHoiirk5FwoxJ80esJfcRVKfboJ8P8uUnXvVJjf8UhhqanDLEMZIsv5pKBtG1CDbsbuEh6wse1DZ/R7Fw/1v1KkI30K0H81+CLw35aW1i8wPb+q8RmLUZ9k+6AX5tm9BL+T314pgjcBJA3Y70TZjGYoMSLtnYfxwFkjPS0CcCaq25/oEv9D4CQA/ZuysprLvZ7nagz3YieYttE4DGFq0j3eQhXz6Ju7vRBMpKYN6EBlRpzp9nxvcyTy5EzAVzxv+TcFXxzg5lAoeJFlPV1mWvOytnZE0DFhMVEoC+7xHJ+MMKB7vKCKDKRfC0Va2KydOS73dY+FI/fTCTbp/r+BX52PVPhL0lwaNVzn2ko7gsjIn3UCqCoNHnYBg678sTdF+UMpg27wsAtUkyxYgIgBqZnVDNO89Y/h8LmFeqn8m4FfiBbNAM02zcUAazCDhAanDSBHoFAGVJKDs7UcHDcBD4OTJpzNZaDyDKhyFMgBnLQgiMlhzT4p3SGIyz4tFuPTM345AIgyw/TlT0+BIAH0u4CUwfDZipoGBLdVCr02CoSywLALMDSoqU9pg4kGLcEDLqBwrkUTdIq57JjQ5G9CGwFAt+dyXRBCAHC0YHYyBuv2EoIgQ1TYwpjfqziWUmwLxdUJZZzTo0WZLYUthfqoVGlbsILWBNICEGGiDz4tJuPT0ya/qm5IZX8akHRepTSngTVgAalOr7PXSr9QNTkzI+JzmowzBvJ2JGA0AySS2JjbEvTUDPlOy9d1BIHI2pfLrbqnL/NiQQzUyWKR/wPSMABxZ260bxbRHy2iQELr4GGlDrSz889n7Rr5np21Xq23eEdC8b59Q9iWc+jtPYfNh776of6n5O7S5ysCjm/EUSU9Sn/Yo9SvfjiavPfZXHzwhAedx7n+G1W4GfQ2sVDSAAAAAElFTkSuQmCC',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAtCAYAAAAeA21aAAAWJklEQVR42r2aeZhV1ZX2f3ufc+58ax6hikGgmAVBEI1CoaCACEZTOEQ73YlN9HNI8kU7dqfTRWnyGWM6MZ3BBLWj0dZOVUyiokFFoRyQURAQKeYaqKKGW/Mdzzl7f3/cW1hGbY1K3+e5T/1zz6611l7vu9Z61xF8Dp9qkGuqEKIOF2BBIaHvzGBaiY+5JWEquhJMkAofBlp66D96wvzh8teczRrkGqAG1BuLKcrK5yfZLhcIUBqIuhwKWew50s0bTzTy2tqDdAHoKgxRhwL0Z7VdfNYDaqswVmUc/9Fsxl0+hmsLvCyzPEwKQo6wAAVIQAoSjQH15j7Psotael5QYABaCNTmwqLpM2bGtgbGDvqxM64Z6f8xaOMmbd5pT/KnRw/y0I/20qI1AgHiMwbhMwVAVyNFDerusym/YhTfKvPzj1l+QgA4gE4HxjVQRp/XGjwSTuxt8F17XrzlTxpk5qYFIJYy3nqgIFU7ZnJ0hTsuYguNiUIj0RIEJhIJkSht+7u5e/561gJudTWypgb1vx6ATBq6Gy/k8qnF/LQwxBhsQOEiAI3EQGALzfE80X080HWkU1wzN9m04Z7p5P7zXnqGQ6gG1DcpKP2XosCOwvLkCKZ1KISWmfvVgEIDJoYScLyXJ9bu4v/ce5Q+DeLTZsKnCsDQ7b2xiGtmlPF40Iskho3ATCdm+uS+XksdOJwrQ+3eLZs69fUsa7GX+Lgr4OHCdzr55uKXeWoIQrsu45+Uh51NfynoXRIKP5Ma01fsndotver9NiqNlgIXL2akl9cea2DFN3fT92nhID8N5tHoR87izMll4pfBqYagQjqEhYXOGKvTAQgczdVu1MOfswZa5ixvmXtdLtvH5fN3pSHK4i4mQFVtmiFyffz91Gyem3F5V9nvA/21b0Z8RuJwlsIEPcwtKRAaTJXAyc/lgmVn8BshkFSnoXTaA1BVixICFozhrtxxItf1obCEifme4wBaglU+aIxwBWeYni9N8Fn/le2jEBfn5AB71zbwrABYgwDUgMurXh/ebEc+pb36hpKkQXbca+hMfv912kowVAJnXB6rdn+RL4salK4+zQGoqsIQAv3f53JBaZ5YQUBoAwx6NPToDKdnLHSAwhgF4RSelKQ/JRQKO+oi26J8Z10bMVWNrNuf9q+nnyfjCZLxpEV20huanGXDlAjCzVSRD4JXSIU0QI/28/3VFRSImlOkenoCUNuRPvy8IlZ6cxCYKBTQqd93+wAiTVgE8pOEHZOoKxV+rOZuHpi1jr/oKgxRg15Vh1LVyPkbqG8Z4AdKC8PvSsczcgDGA6Ot9wL7QeslNjrHT/lNFVwJsGnBUPH8/AMg2IQCjIRisrZADd10LHOS/iBbEkqhUG5xQJmRfrav3cUdWiOGNTJa1KBrqzAq6vj+7k4eKA1qk5Bj45WaUhMKDHA/HOEqXW90np8lgKhM2yg+9wDoNAGpm6aTlWVQLlS6FHzcQ9pnu2PzbUMYTu+Bblb/pJlk3aoPhEu/U4fWqzFXvJn4RirlPoHQFj3KxQWKTPB+OBRkOgoiaDDpZzMpkCLdRZ4WCAgBb3SQSmhipDL9akyD8yHIS2eHa+Q4xhkTI9HnD6ql5z/PbiFQVXUfdOUugRJrsQF77tH2Lze57n8xoEwVdW3CArIlH3G3AgX52QRum0JYpxuLT5wB5t/QMGg9H1PUE5UedhHVc+W7SpP6kLTUaKlx8GP1xXTr87363nmXcd7hJXzpQKexXjzobhhOFQI4ZyS+f7vMunbpNGfesXZ98Nkd7o+vjjAj37Kn0S9tPagt8SEwU+nMpD9OdEucwdPaCNWCcRW4D81jwXUVvOwRSK0QwwxTCrQ0MPBAb4zNuweNn85apO+QCf9ccAiEnWTLCbl6dI39O12LQVV6FtjxHXHX7El8ry/iJeDROKQ2vrDOvOO8AvvHRQEqsXEzRGv8FcxcPBgn2s29lz47cv4e0dir9CfvDP+2MpjuScS8hrKVnoMFBlJo4ckMLSbgQUovRo9D94Fu7s99jIvOXqBmvXGocO6MByoSFz9WkTzcHvQKy7kyc6ASAnXrErKml3Ljpn05euHDFalFj05IHYsEF46bZecWP8HSI/08PAgSb6YeaJw0fWZ8UKi8ltxJawP6fA1s4pNXAvm33L4A9WB2wayRAfl1tzFMakuxUE1hVJ9HM+BxuvrElu0d3LGjkfMn1/Et/Rvctg7Ppf+xpUAHPa7n5KBpPbarQEvn/QaOMBgbTxk5928pIYmwmvoto/5olioPMAZEYnwtN9Sf4LLWfrYkQOPFxERhARbCOZql/J1hqzDbrURDJZ98ODL/htsXAKO9nBWUMqClckSvz7R7fa7XEEafq5p/0cbSGhp7hyZFWvHmh1W+JbVQCATaFQjTb3JyGAR1foj4oCtVJG4KU2ptCmTQcmwtOAhK6NXCFGt5Dnjp9UtZUiiNayu07yoctNsREE5bQJiWxlUidNo6wU2ZvwlXtyfQCg3K1FpKhOPgNsWSv6ihsU/Pxhoak8+umZ1Uwun8yswuDI3O9bpcMrGbvAJ9KHOoBIgX0RgSTusVk3qJpgxVOXpQXDyut61nkOMg9JpSXF2NlILU+c/xzMRn3avf3Vj4a3dnqbCbw8o00S5ax121FYApmFojdDVSV//PPn5cBoiNCzAqb0bzS9gxiLXtsPN61HV3hyxrlmtr1wzbxuDI3lSXFTV/dgSP2InNTrTWSCF22t0xY/OVs7tmTsyLKsvSYmJRnC0NshsUbAKtEUKQ/OI9+qVvLWxd/YVR3c6sUSmjO+K8Ne5eWrRGrhGwBvjeAsyaepwX5zMhld0oHOnXRmtAmW1hs13Zzz6Wk/yDaAexn9SwsQytEWsEouZDoGH+T2KHrEEtrMehfvg01teTY5pfn4/4eaGU56hJER0uTpgLNfcWeegQh3lk+2qsNZXpGf7ESfePI3ONr00riXsA1R+TurObTl2NZD/y0G0Yuho7bhkNuJq5I2NgCHwWe3U1cBtWDSQBqEfVncfZs0bxx3y/LkfGtCMdaM/CcFXjfQ2RgXtGkXvJLK6uCHDtoGJgX4QHhOBZQA9l5scGINOnu0Dg1Uu4cnoRS5XG3XmSuos38Oy1kciO50v01y6QoTdCps52k0IZlhamhy9p+N3cB7FFOojmzhG8Go/orX6/nE8KJS0tOiWDGUNOdRFP36Kbl00CUxoCR7O9g2OLfqIVkFzkCU+Ykidy2mWib8EZqZ/nZ1GuBklhYZonQ2YypZ31Pc6fty1n6ZgQ/68wxEyAoIY8H0sPXcl/17dyp6ihceMCzIX1OB/VBwhdjRA1qBcWc/G0PO7O9zPXa6R/GXNw2wd5fssJqq99U+zqLCp/rWBm3/lqVJ8jwUykaP5hI1N+tR86O0lVgXsUvE9+W9RMKJO3q0FtSyGsfYfV4y3Nek/IR6jIw0jHRXuDlI0qEZdY6aleNLXpzdFB9rpKBA81ZVUOxDzZg7aOTyhQRRWlMT2qOCFESxhnT2H0dTv66+DCdjEtwDf8fgxiwsaWluNzMTO2d0fZv6WDr1y6gR3DZTQxrG0/NXa/dRn/OiGX74Y8eIclTBIXDxaiP0HfScXd2/9QevjK0eJR3zkd4cZ+Q7R1e53DXYH6AYes4mBqYOmMnt5+pcs9mtG5FsW4GVR6PoR+35cPpHv/IYkjKelLGMSSBvuaA7ppwOKSbJuclqwj9aHeV+ae3zul0MP5uLh0+HWqMdvsSjqPOtO6Nvo9rC7wcZ4IQDxKz7tdXDr7Od7U/5aGgxiOeWrQB1byg0kl/DM6PekN2Ox+qymQKvXKuWNLoq5laAADA04kqI/tzC9qlubkoza6KGiLcdk2RWGHwqwU+N33nHOGOaQ+ok7LYWEZ/huBSKvKaDTy1YYs3d0UFlON1J6CBZ15uQHKGBT2YFOWtf9EgGNRddfVbe3VQ4+vv5iFZ+Xwf0M+Ko/38pupz3D7kKYphouS1WdSsWY2DTa4vUme60uy7oZ3ebJtf6nv5jH2yzMLOXNKab9bkJeSroE2YpZ8+Z0cTrpwUUUfJeEU5OJSiKALTRdaCSQCIcVnVKB1+itNiCckf96by/y+ICOn9JDKjzvHDuaY2zus4y/EY7c/3tn31J1nUnHrRGY3DzJGmKS2tfLihhYGZpYxWLMzvV/4AAfccz6504Ms7+glGndpvnkH+2rLYFULccB3T3nR2skhef3U7KQeP3aA9sNZel2nTy6eEWFUfhIVkoixAjwg+jUcUJyWj4BXGrIxW0J6glfrt6Qr9gyIjbK484Gl49xgsRRf9Rp6athPvmGk4dYXJ3q0h2/OWsdDw4nwPQjUYohVuE/O54KLRvMjSzEn7nIyy09jez/NSZdtnYodL76dXzXKsL46y8TvU5J3/CmxYlo3vmwNE2WaSCTQpOCk5pRW+Dl9NCBM2HU0xJ7GECFDk50Tt8ef0b+t2M8Zfj+lGREdXFJoZAZMpivhlSZWX7yBB3U1pqjBEcM1/ucu5PIvjKQu24eJi4uV6dkzDtgJUnGHQyd6fKP3NIdD8aRBUTjF4kk9WGOAETKt3HRpaFSfw97pw6EgLNjbHODYgVwu9GpCF7RqfAiiEvrNFINeg6Rl0OchoVVST4y4/rAbwMXp07g7O1hx0Xpe1FUY5sYFmKIO58VKFpxbziMhA4EDJCyDkz7wOOC1bXyOY5n4LT9Ts7ITlOY4vLorn37bwEFgBXT6dmIamk9T6g9XmoQmS0EIAa0h4XR7dSLqEcmU4WlPQJ5tvNQaT22WfeH6HtGfmjXdXZvtY0q2i55XxKPblrNC1LHdXFiP88BMJswZweMhgywEoiPOrld3WA/M6co/1x9wzg16qAgGleVaLsJrI4MOOUGHOUqyIaWJpyR+Moxv8wGB9HRwgOsI4oamwRac2JOjBwwdbdXu0ZhMbn4unnpoY1ffzlMs9zasz2HlWSP5fVGAWQGDkvFhHv3pDJYZ1xUTvHEWjxdnMRMQrQO88vBbrLrpkL3p/kTv0xt1/++/EMv7yx8Tbtu+JMHWASs/FgkY3Sf9HPM4dGlBgdehoMyBsEQkMhL56fI9U0pbIz6O9VkkwykCowa0zBt8O1Tc/9KSydH9145Pjq0aS+HaBg7pauTUTqyVO+gs0zydE2BUlsHUUA6FIS+WOPwl7htXzO3JKDRHefiGOm6ph8SO2VizAbET++aLyP/hZM5q6WL8u62euT0DnvlFeMZ6BjyiGyFKCqNUnt2PHmcgujQcVWCdxgyQsPFgGO/RXM6t6EdM7gUbG4mVVm8hlUId7+XX/76VOx5sI/bKMOZ/dhHL5hZyzYkoL4nXl7F+VD6e1g5+O+8FHgOoXoB5Vz2OBt5cxt9PyuOunADlQ82R7dJnIELySI7R0BTi7fwYV07uxijRkGdAj0oToTh9HPDMvlwmdYSpmB7RlEUVKcBIL2aVAxJMvMimXtbdtpXrn26ktxaMqwTu8FWbmAf+LWnuTunMpubqP+BeORL/D+Zx37gsbpYCsEliYpzaTMl0hzawuYTnkoLzJkcYdbaNLpQIB9inIK4/xfLt4/GfTAme2VXA1JiH8rwUIuwgtEAbGjc7RnZBEpVCaXANP1ZrL3/5l61c8chxkoi0arxpE7KyMtMKCwHq9xisSq+gV5VScN98fjc6lyXEUQg0FgatQdxuH07ABaFJmArZFKQ+bpBb1s8XzhtAjTCRUQWH1UcuMz5TCTThZI+HjfuyddAQIuG6kZNRY6t0zWafFJ0eObircl7f5aPyuB4bFxeFH6spwsOjn+LrWqOGb5JNDUJoEKtwa6swVgk4dAX3js5jCTESGPiSGvVus/jxO/XBXTHDzCVbTOrCKS+XzMrzivKIxyHZ7yHeLPH1OumhRp2mSiCgPWYQinnEhSMSMC0SjMQpPpFia9DgTzPq2MtT/HH/FbRPzud2QJEkWZbD1zYuY5MUPK6qMMi81XLKxKH28JVFLDi3jBc9GqSBJ+YQPdDNrbPX8VuAdSs4Z3qQRe0J5o3R8uxAylcycCRb19uIqRP6mDYihnZAyNODfUx4+UAW4WM5zJ0RgbJoOtgm9CfQHQP855tH+Mbf7SG6ZyXfm5zHXaaLwoNojfLmyCffewfpfZpgZWW6YSzP5kafiUcKrEiC7m3tXD57Hb+970yCjVfy4OIctowK8f05+SwvzFMlwfKYW3JGP1Nsg91tAeJJiTBPTweIAT0xQ3d3+N2KnKRLaSztiAbi2FkSd3wRX5s4mhuFgDOf5u53O7jVNbBxUfkGc391DmfpzAB4KgDVGano/nOZNsLPChQqoel/rZVVC19gg65Gzh/LNaPyuMEjUCQzw6prQNwwKIyJ6dm2ndfjVVubQjA8xJ9f5oNAH2oNiIA2DccURmp/ntT78kj2eDUWFi4SBzUuxK3/kEdYa+SZz/GLg738GInh9WJUjuAqgDW16SNNgDWb0uPw4mKuC/jwa404HOEHX9zEy7oaE1AjfVyPRiNQCU2su9WzXh3LdvtcUZrwcE4Iwz/SD7s7/RzNSrlnlCakthFCfG7k5wwMWObhk36nS8fXNcdkn7/Zs0v2Gg3Hc63mK+a3XzMpnzsNB5HvZfTl07lYCJ7StRgrb+LetYtYWVzANL/kvDOLCRpXEQWEqUFQj/va+eSWBFiMH9F6kj9NX8f9QxPTfWcx+papzNEOwhaYB7v59oz1qYegE8DzldLcOZPD7jKvYH4W8uxdjdm+sFdRmJdSykZK8Zlwr4XARUhz+/FAbM8A37i3rfuh96VGD1gR/r0kzKp8k/GY6MWjmAs8deg1zGciDNzQzi0X+VnvNyjMTWDpzCsNsq4KKUAnfJQpD+M7u3nz1Qg3CYG9dl06TQqDzBHgExa6c5BXZqzjEV2NqRdgarAfbet5486Dke9+qyGycF80Of3AoPPzVxqy4r29XimtNFiUft+rPh/rttIopXExEHgx3zlhbH7iqHnpvW0dD2kwdRVGLRhaI/VqrDtfp7c/zgZMhAYRSZADMOEkTm0VxopN1O84wcp9PdxZ38ep/aG5Kr2qFnsGOdzVxPKj3Rz47m46q6uRq0F/fScsG0mF14PGRu7u4ZcCnLoajFWZSl8FRhWwCpyftvQfBm67tSTnqe7d4e9WjjMXTy6Lp4dyF6V0Bkjv1SCBHqYYCLQUCGmlm62BBP2NffzsH/fZ92yJROK16dHdoW5YtNam63pdLw+W+viqLwvLdt8j+FV1uBqEeIkXh80UeogDNMC3txAHXjslkNag1mS2Kl6DMsLIlhM8vXwDz1aDzDgPoOvArRsmrgJSnOytB169pbfoy1Vxdc2scfGZBozwe4cJJHqY5qffe8sk6uAmEhzsirL+9Q5+dcNmGmSGuYfeSv0rglSZBcuuHctZMzObe3xmRmKdMsSf6b0AwPDdwHB0itoqZFUdaqhLGhJKdl7Gj7IDjN66nxuv20fPJ1k/V4HxlMAdqgYvLmKyXzLnzGKmtMSo0C75UiKlxOe6DGgwDYPOfJODDRG2betg27ff5sSQHQyz6yNaBDE0LO5ezuq4Yte5z7N1SO/8qOf+P3szMKsEIBYrAAAAAElFTkSuQmCC',w:64,h:45}}},1173,[]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,y.jsxs)(r.default,{style:{gap:12},children:[(0,y.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,y.jsx)(j,{}):'take'===t?(0,y.jsx)(f,{}):(0,y.jsx)(v,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]);function j(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[x,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===x?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,y.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,y.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,y.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,y.jsx)(p.Seg,{value:x,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,y.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,y.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,y.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,y.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,y.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,y.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,y.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function f(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[x,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=x[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,y.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,y.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,y.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,y.jsx)(o.T,{size:16,children:e.name}),(0,y.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:x[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(x[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:x[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,y.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,y.jsx)(o.Muted,{children:"\u2014"}):(0,y.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,y.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,y.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,y.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function v(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,y.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,y.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(r.default,{style:{flex:1},children:[(0,y.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,y.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,y.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,y.jsx)(k,{id:e.id,me:t}):null]},e.id)})]})}function k({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[j,f]=(0,l.useState)(b.lines.map(e=>({...e}))),v=(e,t)=>f(i=>i.map(i=>i.ing===e?{...i,...t}:i)),k='expected'!==b.status,S=(0,l.useMemo)(()=>j.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),$=S.filter(e=>Math.abs(e.pct)>=.5),C=j.reduce((e,t)=>e+t.received*t.price,0);return(0,y.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[S.map(({l:e,i:i,short:l,pct:d})=>(0,y.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,y.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,y.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,y.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>v(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!k?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",inputMode:"decimal",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>v(e.ing,{price:100*((0,x.parseMoneyInput)(t)??0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,y.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,y.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round(C))]}),w.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[w.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,$.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[$.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,k?(0,y.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,y.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,j,i,[w.length?`${w.length} short`:'',$.length?`${$.length} price changes`:''].filter(Boolean).join(', '))})]})}},1174,[812,1000,1152,896,17,385,85,777,876,851,804,1144,1002,840,8]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dayKey",{enumerable:!0,get:function(){return t}}),e.parseDay=function(t){return null},e.KitchenCosts=function(t){return null},e.useKitchenSummary=function(t){return{stockValue:null,lastCount:null,costed:0,below:0,target:70,avgGp:null,prices:0}};const t=(t=new Date)=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1175,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,1179,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1178,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1179,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1180,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1180,[17,777,858,1181,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1181,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1182,[812,1033,1177,17,1183,219,385,409,85,1185,1186,1187,777,816,876,851,1034,804,889,1193,1178,1057,1035,1188,856,1189,1194,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1183,[17,385,85,1184,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1184,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1185,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1186,[17,85,777,812,876,851,1185,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1187,[812,1185,17,385,85,777,884,876,1071,863,804,1178,1057,1188,856,1189,1186,1190,1192,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1188,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1189,[17,85,777,876,1008,1033,1064,1062,1188,804,856,1187,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1190,[1034,1191]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1191,[1034,1185]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1192,[17,85,777,812,1033,1034,1190,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1193,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1191,1034,1195,1097,804,1182,1057,1051,1185,1190,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1179,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1180,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1181,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1181,[17,777,858,1182,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1182,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1183,[812,1033,1177,17,1184,219,385,409,85,1186,1187,1188,777,816,876,851,1034,804,889,1179,1178,1057,1035,1189,856,1190,1194,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1184,[17,385,85,1185,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1185,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1186,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1187,[17,85,777,812,876,851,1186,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1188,[812,1186,17,385,85,777,884,876,1071,863,804,1178,1057,1189,856,1190,1187,1191,1193,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1189,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1190,[17,85,777,876,1008,1033,1064,1062,1189,804,856,1188,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1191,[1034,1192]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1192,[1034,1186]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1193,[17,85,777,812,1033,1034,1191,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1192,1034,1195,1097,804,1183,1057,1051,1186,1191,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1195,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1187,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1190,1192,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1188,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1191,1193,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1197,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1198,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1199,[17,85,777,876,1059,804,1071,8]); @@ -1305,9 +1305,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1222,[824,1223,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1223,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1224,[17,856,1221]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1225,[17,385,329,85,409,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1225,[17,385,329,85,409,804,1185,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1226,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1227,[843,1099,861,13,17,1228,917,85,841,1229,1079,1055,777,845,851,1105,863,858,899,804,1181,848,995,998,1076,1107,1230,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1227,[843,1099,861,13,17,1228,917,85,841,1229,1079,1055,777,845,851,1105,863,858,899,804,1182,848,995,998,1076,1107,1230,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1228,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1229,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1230,[17,385,85,862,863,1033,1231,804,777,779,8]); @@ -1340,7 +1340,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1257,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1258,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1259,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1260,[17,385,85,409,777,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1260,[17,385,85,409,777,804,1185,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t,signedOff:!1}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1261,[813,17,319,378,385,278,85,1233,777,910,845,911,863,804,1019,8,1262]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1262,[]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1263,[17,85,1264,777,858,920,1241,1244,804,8]); @@ -1403,7 +1403,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1320,[812,843,17,85,777,845,851,1154,1321,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1321,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1396,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1180,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1326,[]); @@ -1463,7 +1463,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1380,[831,858,998,1379,1381,1382]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1381,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1382,[219,1381]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1183,1172,385,85,995,998,862,863,804,777,1384,1387,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1184,1172,385,85,995,998,862,863,804,777,1384,1387,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1384,[1385,854,843,17,264,378,385,278,85,858,995,998,1386,863,804,1026,777,1387,1339,899,1327,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1385,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1386,[862,863,861]); @@ -1483,7 +1483,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1400,[13,17,1401,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1401,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1402,[13,17,856,1403,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1182,1434,1196,1193,1443,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1183,1434,1196,1179,1443,1180,878,1206,1207,884,776,899,8]); __d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1404,[812,17,1018,378,85,1108,1109,1350,1383,777,995,998,863,804,1057,999,1405,1406,1020,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1405,[812,17,385,85,777,804,998,805,999,856,899,8]); __d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1406,[17,85,777,998,1407,842,804,1038,928,8]); @@ -1499,11 +1499,11 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1416,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1417,[219,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1418,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1180,1388,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1181,1388,862,8]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1420,[806,17,85,777,899,1255,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1421,[17,385,85,1422,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1422,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1182,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1424,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1425,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1426,[17,1384,1057,8]); @@ -1523,10 +1523,10 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1440,[17,278,85,777,857,804,1441,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1441,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1442,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1180,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1181,853,1178,884,1344,998,843,1115,1179,1200,1071,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1444,[13,17,856,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1445,[1446,899,778,1397,1448,995,13,1475,479,17,368,319,219,24,85,805,857,1065,856,1477,19,858,998,876,804,1438,920,988,1480,1481,1028,1104,880,1008,914,1483,1367,8,1484,1485,1486,1487]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1183,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1447,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1448,[1449,1472,1474]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1449,[198,1450,1453,1467,1468,1469,1470,1471]); diff --git a/customer-app/admin.html b/customer-app/admin.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/admin.html +++ b/customer-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer.html b/customer-app/customer.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer.html +++ b/customer-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage.html b/customer-app/customer/anchorage.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage.html +++ b/customer-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/book.html b/customer-app/customer/anchorage/book.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/book.html +++ b/customer-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/feedback.html b/customer-app/customer/anchorage/feedback.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/feedback.html +++ b/customer-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/gift.html b/customer-app/customer/anchorage/gift.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/gift.html +++ b/customer-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/lost.html b/customer-app/customer/anchorage/lost.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/lost.html +++ b/customer-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/loyalty.html b/customer-app/customer/anchorage/loyalty.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/loyalty.html +++ b/customer-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/merch.html b/customer-app/customer/anchorage/merch.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/merch.html +++ b/customer-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/offers.html b/customer-app/customer/anchorage/offers.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/offers.html +++ b/customer-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/refer.html b/customer-app/customer/anchorage/refer.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/refer.html +++ b/customer-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/waitlist.html b/customer-app/customer/anchorage/waitlist.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/waitlist.html +++ b/customer-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/whatson.html b/customer-app/customer/anchorage/whatson.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/anchorage/whatson.html +++ b/customer-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/basket.html b/customer-app/customer/basket.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/basket.html +++ b/customer-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/profile.html b/customer-app/customer/profile.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/customer/profile.html +++ b/customer-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/demo.html b/customer-app/demo.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/demo.html +++ b/customer-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/display.html b/customer-app/display.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/display.html +++ b/customer-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/index.html b/customer-app/index.html index 290420f735e0a34b0b64d1e8fae9b0a918160bde..fb291c9facc7e9d0b7a1a4141f27c0463d27ac89 100644 --- a/customer-app/index.html +++ b/customer-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/kitchen.html b/customer-app/kitchen.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/kitchen.html +++ b/customer-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/owner.html b/customer-app/owner.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/owner.html +++ b/customer-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/staff.html b/customer-app/staff.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/staff.html +++ b/customer-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/sw.js b/customer-app/sw.js index b094e417699117eb651e8829e8bf66e316ff3d2e..2b4c576a9c54d6530d4c3270ee2d5d33ab3c3685 100644 --- a/customer-app/sw.js +++ b/customer-app/sw.js @@ -1,7 +1,7 @@ // Anchorage service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-customer-978bc9cd41"; +const V = "cc-customer-4a0990f93b"; const BASE = "/customer-app/"; -const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=978bc9cd414a85aa91efb94b5142d95e732a9150d325c9855a0c1eeeed236197"]; +const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=4a0990f93b17a2fd5d49ee3f7836ea7d54aa78499bb0962650f5bf2b4ff1cdb4"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/customer-app/team.html b/customer-app/team.html index 3f74466f43fc82e4282f9953a7896c73149d81dd..7de47877f1d0fbc5aa25c02b23211b6201f3c804 100644 --- a/customer-app/team.html +++ b/customer-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/_expo/static/js/web/bundle.js b/display-app/_expo/static/js/web/bundle.js index 8d67281995b3452f545a3a0ab8699e6b547fc747..3b96ce50d555dc48842154bfa7badaecaaf9dece 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1179,1182,1193,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1208,1209,1218,1211,1155,1220,1224,1197,858,1153,899,1225,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1180,1183,1179,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1208,1209,1218,1211,1155,1220,1224,1197,858,1153,899,1225,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1256,27 +1256,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STOCK_ICON_IMAGES",{enumerable:!0,get:function(){return A}});const A={'\ud83e\udd9e':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAABACAYAAACKhS4jAAAZTUlEQVR42rV6eXxcxZXud6ruvb2r1ZJarW6ttpGxZeMlZjWLbTBbgIQQZIckjxAYYHgEQjIJPDKZkc2E/DIhCZM3GSCQeQSSEAaxOazBBmwcbGyQF+IN28KLrM3ae1N331t15o/uNrItOWbycn+/+2vLt27VV+d+56tzThXwV1zPAJLzt2BAtgDiBM2p0JYKt2BAFh8yQADwy1Co7s9V0cc3RaI/uwehYOGZOGlQYzoXJ2oz3v9PNAGa4M9iP28DBgCsKQ9/h+samGsbuCsSe/2HgUD5RP0a41mTAJXvd0ILggB+uaJiXgTG5QlwdYCw/eVk/Pnlo6NdLYBYDuhi+xaAlgP0UlnF1xpM4yof4BtmdPRp5wnq738HAPUVxhti1Z5VyhGAjlrmpdfB91+bE8GrluFQdhlANBGu4uz+saRkyoGq6t92RKK/bgL8Y61V/BprKyvvGqmpTXDdJOa6Bua6Bu6sim17vLx8Go1pV/xdHw4v59p65tp6TsZqmOsaOB6rTb8cLF9UaCcB4I4ylPTFqj/WNXWcjdVkubaet4Yjj4xpQ+PyFwDu94VmdkWrP+K6Bk7GavhmT8kZxYkxIAjAy6GKK9LVtcw19by3MvrS2nDk/uForJ3rJ/HOyuhzCwCDAVE0xu8rKqbGq2tSo7G6dFtF5bf/3Rc6bXck9iTXNXB7VfTxIrDiBNrCkfu4po6zsVrbrq51cjV1vDkc+fpYeh1lcQJwg9tduz8S28G19czVtU4iVnPgSkS9Y/0AAPVEY6u5toG3lEf+pUi9p4LBuSPR6s5MrDb7pLd0duEdEwB+H6q4hWsb+EA0+svimHdY/qZkdW1yqLpu4wLAXaCjyYB4saysaShW06er6zhTXeNwTZ3uj1Z3/UswOInBdIT/BVDyDsC1NxJdwbX1nInVZLiugbdWRp8stDGaC1a5ze+fnohVp/tj1W0AXBLAvvp6NwDsicQe5LoGfjUU/k7hPQsAuiOxR+zaOn4jHL6mMJ4BgHLVtR8djFZ3zwdixzJhdyTyBNfWc7a61snFamyuqecPw1WPjqWYQN7q6vNl4ZsnmebnHK0cQSRZawit13DeSZxnClz7fiAw1SsNz66s8woBWQcw3j9wwGZA7HCyq3Na43yPaxYAoKkJAFBlmmVJzc5rqVR7weGYADYBxYBMAbS2LhjaXFn1zN5I1WMA8LGt/5DTGhIQIBIazNWmsfTRUGiGKLwnCFB3+P3hWS7zOwIEzSCTyBhQamilSr5HAD8cCDQ2FOgRgfQJIgRN2sMArQbQnAejX8rldmY0RnNANQBgxwwFAP3slEogU+/SQwDQWpCyEa21JMJWYEhn3XPnuF3NUyzX371fEb3pssG+V1JadUkiYoAUsy6TsuR8y7qzIDcsAOAmr/eLFdKoz7HWRFSgE3307aHUnl2V0R8vDZavfjlc9XUA6NO2SzMjTNQDgBcWLAkAP/P7B0uEGBphXQkgALRqALA1mwDBHnUfpRTrnNFlCVbfB5Ae1bompbQNZl1r0M0AnC7Nq0ACAGsAAsxcLYzmB4PBBgK0aAGMkJBX5CdYAEIChxz7zR8EAp9pNI3vhgixMikXAUAf86t/SCWufUDrdQX9LOo52tJpx4EeFQwXCs5a4OZR2ry98Pdn+wafnd7d/SgAKAVIgqGYOSDknMeCFbMrhHxRg0H5L0s2sw4YRuhCy70EAER9IDCp1DBmQ2sigMBMAKPOEG03+nxXCSEYrPWI1mEArlmHD/d+YXDwuZ/29qaKiyQVnGfRyMhon+P0uwCPHxDGGNAMCIeZjpXnbQWnNoXs1wzNzMorhetyj7Hw/w3G/zzoOFmDhKGLfTGjxjCv+VEoFBSmlNOV0lWaCAyQIBJZrfBSJnPYQ3JyYVEQLkLoPMDL+RXTOHax4E9WXzaBirsDgdCRJRaCLUL6glJ3GgCWFZovAdSO/GoON0ELQDNAIIJN8szNlMuRED1UWNEZEApgizB7qsR8caU7MCUopam0VgAgiSjNnFqRydjDmo9ImIfIf4HH4yWAl50gfChOwiiEEQBMm+F1E2Xmu1z2se2bC6+cZtBhi5DTgMHMcDRPnupySQmMgrlIP9Jaa78Q7jmm91yRgKoTeasfuRymzA5HZASxCwAcgEulKPlKWZm3YDmaMHQs9vHJP4M2uAxgjjvOccHVssLv8+n0cL+jMxYJIs2IkpjkSguvDyIFoiN2YQKYCCOaZ4oBrfOyRgWdYYYL7LvYizIH5DAAh1mbRCWnELnHDjgBfE3Hf4yJgjwsL/jMTSMjAyOsD4EImw3F73tVWaBGPL3eyjU5+dCzMHESlMc4WSjm0NiRHYA9Qri/nPXmgowDxAQ3Q+eYrd+m05GCTh9redb5zjPdSnWUGIbrK75gyfjR8PFM0/k2I0EhOkYFY6tl6/2GokmWNbOEyVPgxVH9lAoKGx4SJWDOO2ve8HAkoasS9/QL1VgnbMRsIKwkBSCnA1jVfAIkDqAMIRAtUO6kruZmgdZWFRSi19KEq0ZNOCzgAasSkFBjgIv8goUKkpXCR6KqOC0GYBBoBBraIz+XtDB9vWljn9SCBOEit9VYGGxCHLLweR0QMyB8gCBoaAaPJMX49GltBQB8mM12EAPlLDhiavhZSOcTxz+Kh1KQMBJadYGMOjAzAaQAhLXARSlD28QkQeTTeREkiGhhsHFANBPQCgjuBQhusCgsYDmLyDWoVN8/xDtH6QQ82q3UnrmKQackBOqTwAcVQNzKB8s8BjiAUa3TIkccP17uGOVMokoJCiuCCSIQYVA71QDcMg+KJlCbJMA4JHR8RVnZ1y4zPNM0I+Vo6NaCph9n+MLvGYbY4RhOVkZSJH0OU00SUOIof2eABRG6lXNIBA3ZUVgCjrKmDcCm/K3zKy8MoOYrXm9In0g+mEyHGSnbvvFSt+/RR8tLn/QTxZjgYIL8thnQBODBdLprEHo/iAgKmiwFSF3Qo09GYCKkmTqFcnhjRisWRMfpdfHOOzKjQsiSezye4Phaf5gAoJZEvwChyXLfKQlmrWk2Bg0jlGF2Lh5TLThmLNbNkI+kUocHcliFnFEkwDjGYSYQSki0iTdTmXWjzH1Gnll6gs7JYYZHCHmay+8ZX+uTxACFpEwIMBzmHAPIMds678BiJZDTn2jD0YtVaz4C2zRkPZ4alhouGCyOZgMDLImQUk7uY5V9W/xnauijuHI2Ix9V6hPpsQJEO7N3vIdtBQs6di6UBSCYhcgnMobQihslZneGQhcWYhQ5zmKl+Z8hbrAPtu0bMB/I9VmMETeDCUxgDWhmtqUQchj6lYv6+98QbYC9x7F/o/IDjf+l8jOmDLPMaT1yrOUZEKejzd4QCEx902t84wshPz/kt4RghsGglZbBPyh1+dsD/kdfDgYnFzIhMc5ySwAw0GF8mFsXtnlfQDA5bDKRRSQsKa0ux974Qjb7DQE4BgNEAwOteyrNpae43VfllLLzcn9UYYgFCeqwc0/P6O3eXkgN9Vj3aAKsqMf74O/9wdgbhqXJpcXfp21oVvi5zyNWWl7VKey6uzP2/70AI1cf+5U5P6azJhy+/TOW9QuPozW7mIXpoXgqnRgF+hPgt3+UiH/vP1Op3hZAGMvyK2vuhWT8lhuk8VzYkPN1PqpzSEASiEgzA4xuZe8ZI7WqaHUC1MqKyptiLuuz52RHna1CG19K27A0Q4Fwvq2wTyrZlM2oetO84p5QxbU01P80FwpcHwAmAfZDvkjlTNP4Rz9JONMnwYiUaZgemezrX/2//7jq9hVAR7HasbygUChYkm+Bv+K7lYEfl5tySUhIH2wHjnbApsGGkJR01MirdvbCpf39m7cD5oy89fQNXm/lj0tDG8LarCNWOmlq4dcCDuVnmSWgQwg0KEeZwpBddu7td3u6L2vGPAbaFAH6X2vLY9dpz89qtV6qJtUqOWOa1NmcI1yWGEylnyt/qnUJNzVZ2LHDLlbNBMYE+o8i2d94uPvGjY594dpM+vbhmuh2MWcm5BmzQbObnIDLDFaxvJoAngnkCHAI0Hf5/ddVklGnqtPKrrSFR0nkCqRTyFegGh0FQEiltS4Rcr6rvPw8QptNgLG2vPLLfzdqrKl19FJbSk3RKkLOtgUgoFm829f1JgOidcYMNbbcZ4yRw3wW09ws6NlnN4J5455FCxtKS/1NyOYcGELi4EGeMZT42lC0unxn1u7MGMaGJ3h4e1nWuhhTs0zX90EeMqGeCEPYMl9jKwyVI4LIE137pXRNt6wl71VXp2tse3nU471EVJTDKfEr6fNAlAQkpBTDjpPsGRh47KF9vb++mkjr1tYTFW/HOFBzs3z8QPuCr0+f9iakhHYcjZ4+EgNDhNE0kEghnbOzI6T3WVkrWn5+Jqg/P8ximyTnmYpCyjx+piUAZICUth0jEC51oekUrf1BFoI0LJfZOzi0JeXYT7b1DLy/5N13//RJQHm0kxtjS80E8P1z5oR9LnkqtbauB/DWzMrK754SLLktaFmTRU0UOhaxoRUjnSFXT48R7eiZBlJgJw2xi0i3eYCsBNx6XN0l5DMhr1I+rijTas5MW5oGCa0NkJCd/X2t169Zf8dbhw/3Fl6xPvjsZXeWel03diRTNy56fdV7RYc9orWrWxZIAFhcWXHx/5o5Y23X0i8++/CcObPPfPn1nzy8fdPZu4aG707ncrYwTVNYLkuUBk05a6ZE06lQpAC3DfTmwANmnuQTJloEKAXl8UDMO03IgN+EIY1hrdNth/tbalpXXL+6r68XAH4ya9bc7iXXvDqvvuYBtzQOVcNoZ2YqJvDHFfl/MmtWeOmpU35dW1l+eWIkMbJnaPjn9/1p14MrRg4M/+6COY3nVNR+UxrG+W4gCMNQPJywQ1u2TTbP6DOpLAe1vgo8XJgAjw+etIbyuPTwrOkH06bVy05u/av7Ov/tG5s3Hyjm+xsuvfjmpkjFj2AI2j8wcO9pK17/eSFXOlKjP7Z8QQRwGPCvvOLS+6aFy7/lcrvRNxzfuS858pQWcm93Iq3jyp5UJq2QbRiZUDzuO7ej5zZzbp+PqjJQmyrAXT7AHJ82DLABUJLV6Nra6l/ud7s+rresnnK35ZJSWtlczpxSErw+GiyZ3x2Pv7Hq4MG7r39349Z8PEYYqzY03naNyM8Qqy684PJpFeX3VZeFTocs1PUFAVoDjgMQMTIZ0m+9D0zphGhMQ20PgveWTggeAKA1yOOBvOAswO8f4wz5F4ZG4iP7h4fv/cxLrz8MAG8vWGAsWrPmuHKLMV54ekQyW1tf+1p9/frbZ56yRGsx2dY6k7RtV9rRpW5BpSUuy/BLjtc7zjWlCXcpjDSTxyHWdKL9LjaEoCGt+nd2dDw35HB/1nGSlhBDAbeRnRoqH25tP7Dprra2g4IIT197rVzU2uqcxD7X0Vdhxs79MydF/N6y2QvDFdOrykrr+0Yz9YZGXZlp1JX7vSHxwTZTDXRDnD4M7vJCHygBTDUh59m2YUarkJh5arpnNNWeZT5Y4Q/sGU2lO984eHDzrXPPeAeLF+tlS5bw8hNEuhOCf6a5WS5tbVW/Pe+8BVdMqn4q6PXGII18ocJ28pVRzYMH7dxH1tad1ZGe4TrHK5gU04lMoiXYzDD1B717c2fNOVRtuuaCEITLBQgBKBvdA0Mvndn64tIO5syxPD8Z8MTMaCSy3lnyhXeiodCZB/r7V0Y87j+39fTvefHQga1rO3o+vmtqQ1mksuniUyObbq3amZzu7PVA+BWNW2oqpGSckNqckqGBM6ztyZ75j61o/3D3mr6hxI1TpsQW1EZnOIRrS0sCMzZ2HHrwrFfe+DY3N0tqbVUnDb74wrqLL7z1nMkNj+zvH1g56bkVlxSfv7V48aVTQv5rQl7XVQGrNKp9+5WqfovEyoDgLb582d8s7OQeSYoJsAHRmAV/vp9l8lSgbyHF7SFYmjf1ZJIrt/WPPL96f+f+e+efsarc7z9t9d7dNy9atfZXRfr+RfAMkCTif5o+veyOWU3rQ1533SMf7rqgOmDFG/zBr9b4PM3lPt+p8HqRjo8c3tk3vA4i6Ztz4XsLpVubue0ejTYPyW6LOG0cSYSpPAealwafnmI2CatWVT2Z6m5ad0Vj6YVDo8750WBJDNDY0tlz47q+wVXXTZ/ynt8wgu8c6Lh88VvvrOWWFkHLl+sTqg0WLJB6zRpnQXXll8rLS6fu7Tz846fa23tfuHTRB+Gy8jCyWfSn0zuHhwYfWtfdO3JOrPqWxlDFeTq1Cyz7YTZlhT4lw2JIgvtcQJqAcgWqzAJBAKMECYMWls9bMgR37pvvrVr26O6Bnr1XXDHFF/T++7RI5WP7U5m5T2zbtviGWXM2TA1XPPP3kchsLF/ex8dsIh+filVWMgB4TJHe19P7dOOLf/g/v1o4/6ZwqCzc2Xd408pDHV+e+ftnz4in7fQXpzb+R2O04rz9vc5LIzl+lbwSWkFJDxMmOaCzE6BFcdBpaaBMgxWzcDONZnVqNMsHomW+mx8+//KdHV+8+v43e3o+3HKg62YBnT03Fv7dtzZvb9/U1XVtfDT73pRIZFyn/UtFUDw+e3bp1TOmrrNMs/6VPXvOXbLu/S17r77qZ1NikW/F44mR7UO9P5z/yuoH1txuXTNvCj/ji0tW3ZYQ/Zp0wgRBAD4bVMrQZaRkbFTuGdTrp96vPrfukgWnR0pCd02uKL90V3fvL6avePmODZcv/ocz6+t/sqXj4H1zX1nZcsJ69EQPPrhlnjkveqVa/afVlyyc3PDart7DD03/w2u3L54cqvuvsy/aKpi6frNzz5fv3LJlqyDgiel1TdcEU+94M1Tu1DOLEpswZACDdj7ZA6BHpTJcJJPMvwm8O3R9kbrDX126gcHV33/rtRn/0ZUY7l56zYaAx33app4dNee/trl/Irmc8FTHvOiVipYv58ZI5U2jOVuv7u3+Nwbo/qnzGi3LFWyPj/zizi1btvKCBW7FoMZc8pBdFu/j8xLAZ0e0WJwALU5AzEhCTItDTIvDmDUENA5jtDTd1QIIvnKelwDno4GBp0rcnshXP3PeQgLUnsHENw8lU+/GPJOKuwbjXsaEgWves2lHIn44AOPu2zZs2XMbgE6ff7LfMKjG7dndAghUVtpg4GwaSGyaJdvnZtU02m2AXQIYApAeEwoDpA3GRie7bzmgr4rBZgAdfcMvzKyK/KDcZV7GwHMXrFz5LoCLMF70eBKWL34ivuSlP955zkuv/JSfeUYCQEcmPW0oHs8s/dPq9uWARmurxhIIQHDMoj/D0JADOabOHCidA1wMuAB2MeBmshV4a49vNwB8PNSmuaVFXPvBBwe6E4k19cGSK/mWW0xuaRF8EmV94y8eHGLWWLZMYPt2BoCQaTWZhuxc0ztysChdhT1GHE7znkjOBT1iEo+aQLZgG8EgjwKV2GQGM9lFdakObAWam45YVu0dTP6rMl3fXL17p/fWtrYRPgkx+YvgC5zTxc72jqSeP5hOpgv5ZL7+3JoHsWar5+OGgDcTcMGl3DkWZTZBaEATdMLS6PCLgXZv1yFyDwKHgOVgwnIGgMveeuttABtagEwxuv2rwY/hHQPAFW+//djYikNxj4oBejiW2qFnpOIwUEmjxOSIfH3dUJA1KcAPZA/J0bVrgg4XJ37kC4OkoPRyPhnCnDz4o2fS0iKwYwcVg6XCF9EE8GudwQVGVpaqlMWM/L4OlAAsBS2YDDfD5U/7SuoHQzSIeOHoiirk5FwoxJ80esJfcRVKfboJ8P8uUnXvVJjf8UhhqanDLEMZIsv5pKBtG1CDbsbuEh6wse1DZ/R7Fw/1v1KkI30K0H81+CLw35aW1i8wPb+q8RmLUZ9k+6AX5tm9BL+T314pgjcBJA3Y70TZjGYoMSLtnYfxwFkjPS0CcCaq25/oEv9D4CQA/ZuysprLvZ7nagz3YieYttE4DGFq0j3eQhXz6Ju7vRBMpKYN6EBlRpzp9nxvcyTy5EzAVzxv+TcFXxzg5lAoeJFlPV1mWvOytnZE0DFhMVEoC+7xHJ+MMKB7vKCKDKRfC0Va2KydOS73dY+FI/fTCTbp/r+BX52PVPhL0lwaNVzn2ko7gsjIn3UCqCoNHnYBg678sTdF+UMpg27wsAtUkyxYgIgBqZnVDNO89Y/h8LmFeqn8m4FfiBbNAM02zcUAazCDhAanDSBHoFAGVJKDs7UcHDcBD4OTJpzNZaDyDKhyFMgBnLQgiMlhzT4p3SGIyz4tFuPTM345AIgyw/TlT0+BIAH0u4CUwfDZipoGBLdVCr02CoSywLALMDSoqU9pg4kGLcEDLqBwrkUTdIq57JjQ5G9CGwFAt+dyXRBCAHC0YHYyBuv2EoIgQ1TYwpjfqziWUmwLxdUJZZzTo0WZLYUthfqoVGlbsILWBNICEGGiDz4tJuPT0ya/qm5IZX8akHRepTSngTVgAalOr7PXSr9QNTkzI+JzmowzBvJ2JGA0AySS2JjbEvTUDPlOy9d1BIHI2pfLrbqnL/NiQQzUyWKR/wPSMABxZ260bxbRHy2iQELr4GGlDrSz889n7Rr5np21Xq23eEdC8b59Q9iWc+jtPYfNh776of6n5O7S5ysCjm/EUSU9Sn/Yo9SvfjiavPfZXHzwhAedx7n+G1W4GfQ2sVDSAAAAAElFTkSuQmCC',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAtCAYAAAAeA21aAAAWJklEQVR42r2aeZhV1ZX2f3ufc+58ax6hikGgmAVBEI1CoaCACEZTOEQ73YlN9HNI8kU7dqfTRWnyGWM6MZ3BBLWj0dZOVUyiokFFoRyQURAQKeYaqKKGW/Mdzzl7f3/cW1hGbY1K3+e5T/1zz6611l7vu9Z61xF8Dp9qkGuqEKIOF2BBIaHvzGBaiY+5JWEquhJMkAofBlp66D96wvzh8teczRrkGqAG1BuLKcrK5yfZLhcIUBqIuhwKWew50s0bTzTy2tqDdAHoKgxRhwL0Z7VdfNYDaqswVmUc/9Fsxl0+hmsLvCyzPEwKQo6wAAVIQAoSjQH15j7Psotael5QYABaCNTmwqLpM2bGtgbGDvqxM64Z6f8xaOMmbd5pT/KnRw/y0I/20qI1AgHiMwbhMwVAVyNFDerusym/YhTfKvPzj1l+QgA4gE4HxjVQRp/XGjwSTuxt8F17XrzlTxpk5qYFIJYy3nqgIFU7ZnJ0hTsuYguNiUIj0RIEJhIJkSht+7u5e/561gJudTWypgb1vx6ATBq6Gy/k8qnF/LQwxBhsQOEiAI3EQGALzfE80X080HWkU1wzN9m04Z7p5P7zXnqGQ6gG1DcpKP2XosCOwvLkCKZ1KISWmfvVgEIDJoYScLyXJ9bu4v/ce5Q+DeLTZsKnCsDQ7b2xiGtmlPF40Iskho3ATCdm+uS+XksdOJwrQ+3eLZs69fUsa7GX+Lgr4OHCdzr55uKXeWoIQrsu45+Uh51NfynoXRIKP5Ma01fsndotver9NiqNlgIXL2akl9cea2DFN3fT92nhID8N5tHoR87izMll4pfBqYagQjqEhYXOGKvTAQgczdVu1MOfswZa5ixvmXtdLtvH5fN3pSHK4i4mQFVtmiFyffz91Gyem3F5V9nvA/21b0Z8RuJwlsIEPcwtKRAaTJXAyc/lgmVn8BshkFSnoXTaA1BVixICFozhrtxxItf1obCEifme4wBaglU+aIxwBWeYni9N8Fn/le2jEBfn5AB71zbwrABYgwDUgMurXh/ebEc+pb36hpKkQXbca+hMfv912kowVAJnXB6rdn+RL4salK4+zQGoqsIQAv3f53JBaZ5YQUBoAwx6NPToDKdnLHSAwhgF4RSelKQ/JRQKO+oi26J8Z10bMVWNrNuf9q+nnyfjCZLxpEV20huanGXDlAjCzVSRD4JXSIU0QI/28/3VFRSImlOkenoCUNuRPvy8IlZ6cxCYKBTQqd93+wAiTVgE8pOEHZOoKxV+rOZuHpi1jr/oKgxRg15Vh1LVyPkbqG8Z4AdKC8PvSsczcgDGA6Ot9wL7QeslNjrHT/lNFVwJsGnBUPH8/AMg2IQCjIRisrZADd10LHOS/iBbEkqhUG5xQJmRfrav3cUdWiOGNTJa1KBrqzAq6vj+7k4eKA1qk5Bj45WaUhMKDHA/HOEqXW90np8lgKhM2yg+9wDoNAGpm6aTlWVQLlS6FHzcQ9pnu2PzbUMYTu+Bblb/pJlk3aoPhEu/U4fWqzFXvJn4RirlPoHQFj3KxQWKTPB+OBRkOgoiaDDpZzMpkCLdRZ4WCAgBb3SQSmhipDL9akyD8yHIS2eHa+Q4xhkTI9HnD6ql5z/PbiFQVXUfdOUugRJrsQF77tH2Lze57n8xoEwVdW3CArIlH3G3AgX52QRum0JYpxuLT5wB5t/QMGg9H1PUE5UedhHVc+W7SpP6kLTUaKlx8GP1xXTr87363nmXcd7hJXzpQKexXjzobhhOFQI4ZyS+f7vMunbpNGfesXZ98Nkd7o+vjjAj37Kn0S9tPagt8SEwU+nMpD9OdEucwdPaCNWCcRW4D81jwXUVvOwRSK0QwwxTCrQ0MPBAb4zNuweNn85apO+QCf9ccAiEnWTLCbl6dI39O12LQVV6FtjxHXHX7El8ry/iJeDROKQ2vrDOvOO8AvvHRQEqsXEzRGv8FcxcPBgn2s29lz47cv4e0dir9CfvDP+2MpjuScS8hrKVnoMFBlJo4ckMLSbgQUovRo9D94Fu7s99jIvOXqBmvXGocO6MByoSFz9WkTzcHvQKy7kyc6ASAnXrErKml3Ljpn05euHDFalFj05IHYsEF46bZecWP8HSI/08PAgSb6YeaJw0fWZ8UKi8ltxJawP6fA1s4pNXAvm33L4A9WB2wayRAfl1tzFMakuxUE1hVJ9HM+BxuvrElu0d3LGjkfMn1/Et/Rvctg7Ppf+xpUAHPa7n5KBpPbarQEvn/QaOMBgbTxk5928pIYmwmvoto/5olioPMAZEYnwtN9Sf4LLWfrYkQOPFxERhARbCOZql/J1hqzDbrURDJZ98ODL/htsXAKO9nBWUMqClckSvz7R7fa7XEEafq5p/0cbSGhp7hyZFWvHmh1W+JbVQCATaFQjTb3JyGAR1foj4oCtVJG4KU2ptCmTQcmwtOAhK6NXCFGt5Dnjp9UtZUiiNayu07yoctNsREE5bQJiWxlUidNo6wU2ZvwlXtyfQCg3K1FpKhOPgNsWSv6ihsU/Pxhoak8+umZ1Uwun8yswuDI3O9bpcMrGbvAJ9KHOoBIgX0RgSTusVk3qJpgxVOXpQXDyut61nkOMg9JpSXF2NlILU+c/xzMRn3avf3Vj4a3dnqbCbw8o00S5ax121FYApmFojdDVSV//PPn5cBoiNCzAqb0bzS9gxiLXtsPN61HV3hyxrlmtr1wzbxuDI3lSXFTV/dgSP2InNTrTWSCF22t0xY/OVs7tmTsyLKsvSYmJRnC0NshsUbAKtEUKQ/OI9+qVvLWxd/YVR3c6sUSmjO+K8Ne5eWrRGrhGwBvjeAsyaepwX5zMhld0oHOnXRmtAmW1hs13Zzz6Wk/yDaAexn9SwsQytEWsEouZDoGH+T2KHrEEtrMehfvg01teTY5pfn4/4eaGU56hJER0uTpgLNfcWeegQh3lk+2qsNZXpGf7ESfePI3ONr00riXsA1R+TurObTl2NZD/y0G0Yuho7bhkNuJq5I2NgCHwWe3U1cBtWDSQBqEfVncfZs0bxx3y/LkfGtCMdaM/CcFXjfQ2RgXtGkXvJLK6uCHDtoGJgX4QHhOBZQA9l5scGINOnu0Dg1Uu4cnoRS5XG3XmSuos38Oy1kciO50v01y6QoTdCps52k0IZlhamhy9p+N3cB7FFOojmzhG8Go/orX6/nE8KJS0tOiWDGUNOdRFP36Kbl00CUxoCR7O9g2OLfqIVkFzkCU+Ykidy2mWib8EZqZ/nZ1GuBklhYZonQ2YypZ31Pc6fty1n6ZgQ/68wxEyAoIY8H0sPXcl/17dyp6ihceMCzIX1OB/VBwhdjRA1qBcWc/G0PO7O9zPXa6R/GXNw2wd5fssJqq99U+zqLCp/rWBm3/lqVJ8jwUykaP5hI1N+tR86O0lVgXsUvE9+W9RMKJO3q0FtSyGsfYfV4y3Nek/IR6jIw0jHRXuDlI0qEZdY6aleNLXpzdFB9rpKBA81ZVUOxDzZg7aOTyhQRRWlMT2qOCFESxhnT2H0dTv66+DCdjEtwDf8fgxiwsaWluNzMTO2d0fZv6WDr1y6gR3DZTQxrG0/NXa/dRn/OiGX74Y8eIclTBIXDxaiP0HfScXd2/9QevjK0eJR3zkd4cZ+Q7R1e53DXYH6AYes4mBqYOmMnt5+pcs9mtG5FsW4GVR6PoR+35cPpHv/IYkjKelLGMSSBvuaA7ppwOKSbJuclqwj9aHeV+ae3zul0MP5uLh0+HWqMdvsSjqPOtO6Nvo9rC7wcZ4IQDxKz7tdXDr7Od7U/5aGgxiOeWrQB1byg0kl/DM6PekN2Ox+qymQKvXKuWNLoq5laAADA04kqI/tzC9qlubkoza6KGiLcdk2RWGHwqwU+N33nHOGOaQ+ok7LYWEZ/huBSKvKaDTy1YYs3d0UFlON1J6CBZ15uQHKGBT2YFOWtf9EgGNRddfVbe3VQ4+vv5iFZ+Xwf0M+Ko/38pupz3D7kKYphouS1WdSsWY2DTa4vUme60uy7oZ3ebJtf6nv5jH2yzMLOXNKab9bkJeSroE2YpZ8+Z0cTrpwUUUfJeEU5OJSiKALTRdaCSQCIcVnVKB1+itNiCckf96by/y+ICOn9JDKjzvHDuaY2zus4y/EY7c/3tn31J1nUnHrRGY3DzJGmKS2tfLihhYGZpYxWLMzvV/4AAfccz6504Ms7+glGndpvnkH+2rLYFULccB3T3nR2skhef3U7KQeP3aA9sNZel2nTy6eEWFUfhIVkoixAjwg+jUcUJyWj4BXGrIxW0J6glfrt6Qr9gyIjbK484Gl49xgsRRf9Rp6athPvmGk4dYXJ3q0h2/OWsdDw4nwPQjUYohVuE/O54KLRvMjSzEn7nIyy09jez/NSZdtnYodL76dXzXKsL46y8TvU5J3/CmxYlo3vmwNE2WaSCTQpOCk5pRW+Dl9NCBM2HU0xJ7GECFDk50Tt8ef0b+t2M8Zfj+lGREdXFJoZAZMpivhlSZWX7yBB3U1pqjBEcM1/ucu5PIvjKQu24eJi4uV6dkzDtgJUnGHQyd6fKP3NIdD8aRBUTjF4kk9WGOAETKt3HRpaFSfw97pw6EgLNjbHODYgVwu9GpCF7RqfAiiEvrNFINeg6Rl0OchoVVST4y4/rAbwMXp07g7O1hx0Xpe1FUY5sYFmKIO58VKFpxbziMhA4EDJCyDkz7wOOC1bXyOY5n4LT9Ts7ITlOY4vLorn37bwEFgBXT6dmIamk9T6g9XmoQmS0EIAa0h4XR7dSLqEcmU4WlPQJ5tvNQaT22WfeH6HtGfmjXdXZvtY0q2i55XxKPblrNC1LHdXFiP88BMJswZweMhgywEoiPOrld3WA/M6co/1x9wzg16qAgGleVaLsJrI4MOOUGHOUqyIaWJpyR+Moxv8wGB9HRwgOsI4oamwRac2JOjBwwdbdXu0ZhMbn4unnpoY1ffzlMs9zasz2HlWSP5fVGAWQGDkvFhHv3pDJYZ1xUTvHEWjxdnMRMQrQO88vBbrLrpkL3p/kTv0xt1/++/EMv7yx8Tbtu+JMHWASs/FgkY3Sf9HPM4dGlBgdehoMyBsEQkMhL56fI9U0pbIz6O9VkkwykCowa0zBt8O1Tc/9KSydH9145Pjq0aS+HaBg7pauTUTqyVO+gs0zydE2BUlsHUUA6FIS+WOPwl7htXzO3JKDRHefiGOm6ph8SO2VizAbET++aLyP/hZM5q6WL8u62euT0DnvlFeMZ6BjyiGyFKCqNUnt2PHmcgujQcVWCdxgyQsPFgGO/RXM6t6EdM7gUbG4mVVm8hlUId7+XX/76VOx5sI/bKMOZ/dhHL5hZyzYkoL4nXl7F+VD6e1g5+O+8FHgOoXoB5Vz2OBt5cxt9PyuOunADlQ82R7dJnIELySI7R0BTi7fwYV07uxijRkGdAj0oToTh9HPDMvlwmdYSpmB7RlEUVKcBIL2aVAxJMvMimXtbdtpXrn26ktxaMqwTu8FWbmAf+LWnuTunMpubqP+BeORL/D+Zx37gsbpYCsEliYpzaTMl0hzawuYTnkoLzJkcYdbaNLpQIB9inIK4/xfLt4/GfTAme2VXA1JiH8rwUIuwgtEAbGjc7RnZBEpVCaXANP1ZrL3/5l61c8chxkoi0arxpE7KyMtMKCwHq9xisSq+gV5VScN98fjc6lyXEUQg0FgatQdxuH07ABaFJmArZFKQ+bpBb1s8XzhtAjTCRUQWH1UcuMz5TCTThZI+HjfuyddAQIuG6kZNRY6t0zWafFJ0eObircl7f5aPyuB4bFxeFH6spwsOjn+LrWqOGb5JNDUJoEKtwa6swVgk4dAX3js5jCTESGPiSGvVus/jxO/XBXTHDzCVbTOrCKS+XzMrzivKIxyHZ7yHeLPH1OumhRp2mSiCgPWYQinnEhSMSMC0SjMQpPpFia9DgTzPq2MtT/HH/FbRPzud2QJEkWZbD1zYuY5MUPK6qMMi81XLKxKH28JVFLDi3jBc9GqSBJ+YQPdDNrbPX8VuAdSs4Z3qQRe0J5o3R8uxAylcycCRb19uIqRP6mDYihnZAyNODfUx4+UAW4WM5zJ0RgbJoOtgm9CfQHQP855tH+Mbf7SG6ZyXfm5zHXaaLwoNojfLmyCffewfpfZpgZWW6YSzP5kafiUcKrEiC7m3tXD57Hb+970yCjVfy4OIctowK8f05+SwvzFMlwfKYW3JGP1Nsg91tAeJJiTBPTweIAT0xQ3d3+N2KnKRLaSztiAbi2FkSd3wRX5s4mhuFgDOf5u53O7jVNbBxUfkGc391DmfpzAB4KgDVGano/nOZNsLPChQqoel/rZVVC19gg65Gzh/LNaPyuMEjUCQzw6prQNwwKIyJ6dm2ndfjVVubQjA8xJ9f5oNAH2oNiIA2DccURmp/ntT78kj2eDUWFi4SBzUuxK3/kEdYa+SZz/GLg738GInh9WJUjuAqgDW16SNNgDWb0uPw4mKuC/jwa404HOEHX9zEy7oaE1AjfVyPRiNQCU2su9WzXh3LdvtcUZrwcE4Iwz/SD7s7/RzNSrlnlCakthFCfG7k5wwMWObhk36nS8fXNcdkn7/Zs0v2Gg3Hc63mK+a3XzMpnzsNB5HvZfTl07lYCJ7StRgrb+LetYtYWVzANL/kvDOLCRpXEQWEqUFQj/va+eSWBFiMH9F6kj9NX8f9QxPTfWcx+papzNEOwhaYB7v59oz1qYegE8DzldLcOZPD7jKvYH4W8uxdjdm+sFdRmJdSykZK8Zlwr4XARUhz+/FAbM8A37i3rfuh96VGD1gR/r0kzKp8k/GY6MWjmAs8deg1zGciDNzQzi0X+VnvNyjMTWDpzCsNsq4KKUAnfJQpD+M7u3nz1Qg3CYG9dl06TQqDzBHgExa6c5BXZqzjEV2NqRdgarAfbet5486Dke9+qyGycF80Of3AoPPzVxqy4r29XimtNFiUft+rPh/rttIopXExEHgx3zlhbH7iqHnpvW0dD2kwdRVGLRhaI/VqrDtfp7c/zgZMhAYRSZADMOEkTm0VxopN1O84wcp9PdxZ38ep/aG5Kr2qFnsGOdzVxPKj3Rz47m46q6uRq0F/fScsG0mF14PGRu7u4ZcCnLoajFWZSl8FRhWwCpyftvQfBm67tSTnqe7d4e9WjjMXTy6Lp4dyF6V0Bkjv1SCBHqYYCLQUCGmlm62BBP2NffzsH/fZ92yJROK16dHdoW5YtNam63pdLw+W+viqLwvLdt8j+FV1uBqEeIkXh80UeogDNMC3txAHXjslkNag1mS2Kl6DMsLIlhM8vXwDz1aDzDgPoOvArRsmrgJSnOytB169pbfoy1Vxdc2scfGZBozwe4cJJHqY5qffe8sk6uAmEhzsirL+9Q5+dcNmGmSGuYfeSv0rglSZBcuuHctZMzObe3xmRmKdMsSf6b0AwPDdwHB0itoqZFUdaqhLGhJKdl7Gj7IDjN66nxuv20fPJ1k/V4HxlMAdqgYvLmKyXzLnzGKmtMSo0C75UiKlxOe6DGgwDYPOfJODDRG2betg27ff5sSQHQyz6yNaBDE0LO5ezuq4Yte5z7N1SO/8qOf+P3szMKsEIBYrAAAAAElFTkSuQmCC',w:64,h:45}}},1173,[]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,y.jsxs)(r.default,{style:{gap:12},children:[(0,y.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,y.jsx)(j,{}):'take'===t?(0,y.jsx)(f,{}):(0,y.jsx)(v,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]);function j(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[x,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===x?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,y.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,y.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,y.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,y.jsx)(p.Seg,{value:x,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,y.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,y.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,y.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,y.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,y.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,y.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,y.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function f(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[x,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=x[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,y.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,y.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,y.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,y.jsx)(o.T,{size:16,children:e.name}),(0,y.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:x[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(x[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:x[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,y.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,y.jsx)(o.Muted,{children:"\u2014"}):(0,y.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,y.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,y.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,y.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function v(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,y.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,y.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(r.default,{style:{flex:1},children:[(0,y.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,y.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,y.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,y.jsx)(k,{id:e.id,me:t}):null]},e.id)})]})}function k({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[j,f]=(0,l.useState)(b.lines.map(e=>({...e}))),v=(e,t)=>f(i=>i.map(i=>i.ing===e?{...i,...t}:i)),k='expected'!==b.status,S=(0,l.useMemo)(()=>j.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),$=S.filter(e=>Math.abs(e.pct)>=.5),C=j.reduce((e,t)=>e+t.received*t.price,0);return(0,y.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[S.map(({l:e,i:i,short:l,pct:d})=>(0,y.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,y.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,y.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,y.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>v(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!k?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",inputMode:"decimal",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>v(e.ing,{price:100*((0,x.parseMoneyInput)(t)??0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,y.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,y.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round(C))]}),w.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[w.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,$.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[$.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,k?(0,y.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,y.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,j,i,[w.length?`${w.length} short`:'',$.length?`${$.length} price changes`:''].filter(Boolean).join(', '))})]})}},1174,[812,1000,1152,896,17,385,85,777,876,851,804,1144,1002,840,8]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dayKey",{enumerable:!0,get:function(){return t}}),e.parseDay=function(t){return null},e.KitchenCosts=function(t){return null},e.useKitchenSummary=function(t){return{stockValue:null,lastCount:null,costed:0,below:0,target:70,avgGp:null,prices:0}};const t=(t=new Date)=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1175,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,1179,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1178,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1179,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1180,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1180,[17,777,858,1181,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1181,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1182,[812,1033,1177,17,1183,219,385,409,85,1185,1186,1187,777,816,876,851,1034,804,889,1193,1178,1057,1035,1188,856,1189,1194,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1183,[17,385,85,1184,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1184,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1185,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1186,[17,85,777,812,876,851,1185,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1187,[812,1185,17,385,85,777,884,876,1071,863,804,1178,1057,1188,856,1189,1186,1190,1192,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1188,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1189,[17,85,777,876,1008,1033,1064,1062,1188,804,856,1187,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1190,[1034,1191]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1191,[1034,1185]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1192,[17,85,777,812,1033,1034,1190,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1193,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1191,1034,1195,1097,804,1182,1057,1051,1185,1190,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1179,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1180,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1181,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1181,[17,777,858,1182,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1182,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1183,[812,1033,1177,17,1184,219,385,409,85,1186,1187,1188,777,816,876,851,1034,804,889,1179,1178,1057,1035,1189,856,1190,1194,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1184,[17,385,85,1185,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1185,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1186,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1187,[17,85,777,812,876,851,1186,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1188,[812,1186,17,385,85,777,884,876,1071,863,804,1178,1057,1189,856,1190,1187,1191,1193,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1189,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1190,[17,85,777,876,1008,1033,1064,1062,1189,804,856,1188,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1191,[1034,1192]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1192,[1034,1186]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1193,[17,85,777,812,1033,1034,1191,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1192,1034,1195,1097,804,1183,1057,1051,1186,1191,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1195,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1187,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1190,1192,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1188,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1191,1193,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1197,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1198,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1199,[17,85,777,876,1059,804,1071,8]); @@ -1305,9 +1305,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1222,[824,1223,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1223,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1224,[17,856,1221]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1225,[17,385,329,85,409,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1225,[17,385,329,85,409,804,1185,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1226,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1227,[843,1099,861,13,17,1228,917,85,841,1229,1079,1055,777,845,851,1105,863,858,899,804,1181,848,995,998,1076,1107,1230,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1227,[843,1099,861,13,17,1228,917,85,841,1229,1079,1055,777,845,851,1105,863,858,899,804,1182,848,995,998,1076,1107,1230,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1228,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1229,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1230,[17,385,85,862,863,1033,1231,804,777,779,8]); @@ -1340,7 +1340,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1257,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1258,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1259,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1260,[17,385,85,409,777,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1260,[17,385,85,409,777,804,1185,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t,signedOff:!1}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1261,[813,17,319,378,385,278,85,1233,777,910,845,911,863,804,1019,8,1262]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1262,[]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1263,[17,85,1264,777,858,920,1241,1244,804,8]); @@ -1403,7 +1403,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1320,[812,843,17,85,777,845,851,1154,1321,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1321,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1396,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1180,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1326,[]); @@ -1463,7 +1463,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1380,[831,858,998,1379,1381,1382]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1381,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1382,[219,1381]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1183,1172,385,85,995,998,862,863,804,777,1384,1387,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1184,1172,385,85,995,998,862,863,804,777,1384,1387,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1384,[1385,854,843,17,264,378,385,278,85,858,995,998,1386,863,804,1026,777,1387,1339,899,1327,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1385,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1386,[862,863,861]); @@ -1483,7 +1483,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1400,[13,17,1401,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1401,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1402,[13,17,856,1403,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1182,1434,1196,1193,1443,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1183,1434,1196,1179,1443,1180,878,1206,1207,884,776,899,8]); __d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1404,[812,17,1018,378,85,1108,1109,1350,1383,777,995,998,863,804,1057,999,1405,1406,1020,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WipeDevice=function(n){return null}},1405,[]); __d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1406,[17,85,777,998,1407,842,804,1038,928,8]); @@ -1499,11 +1499,11 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1416,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1417,[219,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1418,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1180,1388,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1181,1388,862,8]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1420,[806,17,85,777,899,1255,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1421,[17,385,85,1422,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1422,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1182,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1424,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1425,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1426,[17,1384,1057,8]); @@ -1523,10 +1523,10 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1440,[17,278,85,777,857,804,1441,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1441,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1442,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1180,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1181,853,1178,884,1344,998,843,1115,1179,1200,1071,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1444,[13,17,856,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1445,[1446,899,778,1397,1448,995,13,1475,479,17,368,319,219,24,85,805,857,1065,856,1477,19,858,998,876,804,1438,920,988,1480,1481,1028,1104,880,1008,914,1483,1367,8,1484,1485,1486,1487]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1183,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1447,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1448,[1449,1472,1474]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1449,[198,1450,1453,1467,1468,1469,1470,1471]); diff --git a/display-app/admin.html b/display-app/admin.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/admin.html +++ b/display-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer.html b/display-app/customer.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer.html +++ b/display-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage.html b/display-app/customer/anchorage.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage.html +++ b/display-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/book.html b/display-app/customer/anchorage/book.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/book.html +++ b/display-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/feedback.html b/display-app/customer/anchorage/feedback.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/feedback.html +++ b/display-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/gift.html b/display-app/customer/anchorage/gift.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/gift.html +++ b/display-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/lost.html b/display-app/customer/anchorage/lost.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/lost.html +++ b/display-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/loyalty.html b/display-app/customer/anchorage/loyalty.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/loyalty.html +++ b/display-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/merch.html b/display-app/customer/anchorage/merch.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/merch.html +++ b/display-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/offers.html b/display-app/customer/anchorage/offers.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/offers.html +++ b/display-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/refer.html b/display-app/customer/anchorage/refer.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/refer.html +++ b/display-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/waitlist.html b/display-app/customer/anchorage/waitlist.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/waitlist.html +++ b/display-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/whatson.html b/display-app/customer/anchorage/whatson.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/anchorage/whatson.html +++ b/display-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/basket.html b/display-app/customer/basket.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/basket.html +++ b/display-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/profile.html b/display-app/customer/profile.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/customer/profile.html +++ b/display-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/demo.html b/display-app/demo.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/demo.html +++ b/display-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/display.html b/display-app/display.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/display.html +++ b/display-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/index.html b/display-app/index.html index a5ed6ce3c177d5e7f446ba27569b040d26d0c6d7..5abc7b42141e963029c786324148e799bb24aaca 100644 --- a/display-app/index.html +++ b/display-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/kitchen.html b/display-app/kitchen.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/kitchen.html +++ b/display-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/owner.html b/display-app/owner.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/owner.html +++ b/display-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/staff.html b/display-app/staff.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/staff.html +++ b/display-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/sw.js b/display-app/sw.js index 4421bf4586970602349d79cc36a4c5bc065b3964..341240a4514b82a0ef8b1fc303c74026d304b8f9 100644 --- a/display-app/sw.js +++ b/display-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Display service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-display-80c7f0ba82"; +const V = "cc-display-83e60c92fd"; const BASE = "/display-app/"; -const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=80c7f0ba825923d7615ead9fd2234810e358eaeb6c07a6962fe8e953b9ba391e"]; +const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=83e60c92fdc1bf6f20f3be4c315afe70e1c0e41e4b1291eb2c864e9bd4fcf61f"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/display-app/team.html b/display-app/team.html index e5c368cef26d944cbaa26f7771f6b45e4606c332..94411e21d62518872f6c6d053875b17194c7937e 100644 --- a/display-app/team.html +++ b/display-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/index.html b/index.html index 61a5ef56de12a9de25898c0de8a4d0e2734f1f9a..24b5c15768b8a80e1be7010afb769227f133e285 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.212) +Cover Charge: try the apps (v0.3.12.214) @@ -63,7 +63,7 @@ footer{margin-top:28px;color:var(--muted);font-size:.8rem;text-align:center} Cover Charge logo

covercharge

All in one restaurant booking app

-

Cover Charge: try the apps (v0.3.12.212)

+

Cover Charge: try the apps (v0.3.12.214)

The Anchorage, Harbour View, Dunure

@@ -129,7 +129,7 @@ footer{margin-top:28px;color:var(--muted);font-size:.8rem;text-align:center}
-

Cover Charge v0.3.12.212

+

Cover Charge v0.3.12.214

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index 21c4e10449dec2b7c44dd529f54a156ae16f3815..e5645e131cac00bd7e3147b9733245f7676bd937 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1185,1188,1199,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1186,1189,1185,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1262,27 +1262,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_DELIVERY_NOTE",{enumerable:!0,get:function(){return t}});const t=null},1179,[]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpOverTime=function({rid:e,width:b}){const $=(0,n.useGpCalcView)(),P=(0,o.useRecipeCards)(e),[w,k]=(0,s.useState)('3m'),[v,D]=(0,s.useState)(b??0),_=(0,s.useMemo)(()=>P.map(e=>({id:e.id,dish:e.dish,price:e.price})),[P]),M=(0,s.useMemo)(()=>(0,a.menuGp)($.ingredients,$.cardCosts??{},_,$.settings),[$.ingredients,$.cardCosts,_,$.settings]),G=(0,s.useMemo)(()=>(0,a.gpHistory)(Object.values($.deliveries??{}),M,w),[$.deliveries,M,w]),T=(0,s.useMemo)(()=>M.dishes.map(e=>{const s=G.points.find(s=>null!=s.dishes[e.id])?.dishes[e.id];return{...e,ch:null!=s?e.gp-s:0}}).sort((e,s)=>Math.abs(s.ch)-Math.abs(e.ch)),[M.dishes,G.points]),[A,I]=(0,s.useState)(null),C=(A??T.slice(0,3).map(e=>e.id)).filter(e=>T.some(s=>s.id===e)).slice(0,3),L=(0,a.gpSummary)(G.points,w),F=240,S=(0,s.useMemo)(()=>v>0?(0,u.gpChartLayout)(v,F,G.points,C,M.dishes.map(e=>e.target)):null,[v,G.points,C,M.dishes]),z=e=>M.dishes.find(s=>s.id===e)?.name??G.names[e]??'Dish';return(0,p.jsxs)(d.Box,{testID:"gp-over-time",children:[(0,p.jsx)(r.T,{size:20,weight:"bold",center:!0,colour:c.colours.gold,accessibilityRole:"header",children:"GP over time"}),(0,p.jsx)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['4w','3m','12m'].map(e=>(0,p.jsx)(h.Pick,{testID:`gp-range-${e}`,label:a.RANGE_SAID[e],accessibilityLabel:`Show ${a.RANGE_SAID[e]}`,selected:w===e,onPress:()=>k(e)},e))}),(0,p.jsxs)(t.default,{testID:"gp-summary",accessible:!0,accessibilityLabel:L,accessibilityLiveRegion:"polite",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(r.T,{size:30,weight:"bold",center:!0,colour:m,children:null!=M.menu?`${M.menu.toFixed(1)}%`:'\u2014'}),(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:L.replace(/^Menu GP now [\d.]+ percent, ?/,'').replace(/\.$/,'')||'Menu GP'})]}),(0,p.jsx)(t.default,{testID:"gp-chart",onLayout:b?void 0:e=>D(Math.floor(e.nativeEvent.layout.width)),importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{width:'100%',height:F,alignItems:'center'},children:S?(0,p.jsxs)(l.default,{width:S.width,height:F,children:[S.yTicks.map(e=>(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:e.y,y2:e.y,stroke:c.colours.border,strokeWidth:1},`g${e.v}`)),S.yTicks.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:u.GP_LEFT_BAND-6,y:e.y+4,fontSize:12,fill:c.colours.muted,textAnchor:"end",children:`${e.v}%`},`y${e.v}`)),null!=S.target?(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:S.target,y2:S.target,stroke:y,strokeDasharray:"4 4",strokeWidth:1}):null,S.area?(0,p.jsx)(i.Path,{d:S.area,fill:y,fillOpacity:.18}):null,S.dishPaths.map((e,s)=>(0,p.jsx)(i.Path,{d:e.d,stroke:x,strokeWidth:2,strokeDasharray:f[s]||void 0,fill:"none"},e.id)),S.menuPath?(0,p.jsx)(i.Path,{d:S.menuPath,stroke:m,strokeWidth:3,fill:"none"}):null,S.menuDots.map((e,s)=>(0,p.jsx)(i.Circle,{cx:e.x,cy:e.y,r:3,fill:m},s)),G.markers.map((e,s)=>{const t=S.xOfWeek(e.week);if(null==t)return null;const l=F-u.GP_AXIS_BAND-2;return(0,p.jsx)(i.Polygon,{points:`${t-5},${l} ${t+5},${l} ${t},${l-8}`,fill:y},`${e.id}${s}`)}),S.xLabels.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:e.x,y:234,fontSize:12,fill:c.colours.muted,textAnchor:"middle",children:e.text},e.text+e.x))]}):null}),(0,p.jsxs)(r.Row,{wrap:!0,gap:12,style:{justifyContent:'center'},children:[(0,p.jsx)(j,{colour:m,label:"Menu GP"}),C.map((e,s)=>(0,p.jsx)(j,{colour:x,dash:f[s],label:z(e)},e)),(0,p.jsx)(j,{colour:y,label:"Delivery changed costs",tri:!0})]}),T.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:"Dishes on the chart (up to 3)"}),(0,p.jsx)(r.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:T.slice(0,12).map(e=>(0,p.jsx)(h.Pick,{testID:`gp-dish-${e.id}`,label:`${e.name} ${e.gp.toFixed(0)}%`,accessibilityLabel:`${e.name}, GP ${e.gp.toFixed(1)} percent${Math.abs(e.ch)>=.05?`, ${e.ch>0?'up':'down'} ${Math.abs(e.ch).toFixed(1)} points over ${a.RANGE_SAID[w]}`:', steady'}. ${C.includes(e.id)?'On the chart':'Tap to add to the chart'}`,selected:C.includes(e.id),onPress:()=>{return s=e.id,I(C.includes(s)?C.filter(e=>e!==s):[...C,s].slice(-3));var s}},e.id))})]}):(0,p.jsx)(r.Muted,{center:!0,children:"Cost your recipe cards to see dish GP here."}),G.markers.length?(0,p.jsxs)(t.default,{testID:"gp-markers",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,weight:"semibold",children:"Deliveries that changed costs"}),G.markers.slice(-5).reverse().map(e=>(0,p.jsxs)(r.T,{size:c.font.small,center:!0,colour:null!=e.change&&e.change<-.05?c.colours.amber:c.colours.muted,children:[e.date.split('-').reverse().join('/')," \xb7 ",e.supplier||'Supplier',null!=e.change?` \xb7 menu GP ${e.change>0?'+':''}${e.change.toFixed(1)} pts`:'']},e.id))]}):null]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=_r(_d[2]),l=e(i),r=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const m=c.colours.gold,x='#C9CCD1',y='#B0773B',f=['','6 4','2 4'];function j({colour:e,label:s,tri:n,dash:o}){return(0,p.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:6},accessible:!1,children:[(0,p.jsx)(l.default,{width:18,height:12,children:n?(0,p.jsx)(i.Polygon,{points:"4,11 14,11 9,2",fill:e}):(0,p.jsx)(i.Line,{x1:0,x2:18,y1:6,y2:6,stroke:e,strokeWidth:3,strokeDasharray:o||void 0})}),(0,p.jsx)(r.T,{size:c.font.small,colour:c.colours.muted,children:s})]})}},1180,[17,85,780,777,905,858,908,804,889,1157,1181,8]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GP_AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GP_LEFT_BAND",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelW",{enumerable:!0,get:function(){return u}}),e.gpChartLayout=function(h,i,o,c,s){const d=Math.max(10,h-n-l),M=Math.max(10,i-t-a-12),f=o.flatMap(t=>[t.menu,...c.map(n=>t.dishes[n])]).filter(t=>null!=t),x=s.length?Math.round(s.reduce((t,n)=>t+n,0)/s.length):null;null!=x&&f.push(x);let p=f.length?5*Math.floor(Math.min(...f)/5)-5:50,b=f.length?5*Math.ceil(Math.max(...f)/5)+5:80;p=Math.max(0,p),b=Math.min(100,Math.max(b,p+10));const $=Math.max(1,o.length-1),y=t=>n+t/$*d,P=t=>a+M-(t-p)/(b-p)*M,_=b-p>30?10:5,F=[];for(let t=p;t<=b;t+=_)F.push({v:t,y:P(t)});const L=t=>{let n='',l=!1;return o.forEach((a,u)=>{const h=t(a);null!=h?(n+=`${l?'L':'M'}${y(u).toFixed(1)},${P(h).toFixed(1)}`,l=!0):l=!1}),n||null},w=L(t=>t.menu),O=o.findIndex(t=>null!=t.menu);let j=-1;o.forEach((t,n)=>{null!=t.menu&&(j=n)});const k=O>=0&&o.slice(O,j+1).every(t=>null!=t.menu),v=w&&k&&j>O?`${w}L${y(j).toFixed(1)},${P(p).toFixed(1)}L${y(O).toFixed(1)},${P(p).toFixed(1)}Z`:null,A=o.map((t,n)=>null!=t.menu?{x:y(n),y:P(t.menu)}:null).filter(t=>!!t),D=t=>`${t.slice(8,10)}/${t.slice(5,7)}`,E=u('00/00'),B=Math.max(2,Math.floor(d/(E+12))+1),G=Math.max(1,Math.ceil(o.length/B)),I=[];for(let t=o.length-1;t>=0;t-=G){const n=Math.min(h-E/2-2,Math.max(36+E/2,y(t)));I.some(t=>Math.abs(t.x-n)[t.week,n]));return{width:h,height:i,yTicks:F,menuPath:w,area:v,menuDots:A,xLabels:I,target:null!=x&&x>=p&&x<=b?P(x):null,dishPaths:c.map(t=>({id:t,d:L(n=>n.dishes[t])})).filter(t=>!!t.d),xOfWeek:t=>{const n=N.get(t);return null==n?null:y(n)}}};const t=24,n=40,l=10,a=12,u=(t,n=12)=>Math.ceil(t.length*n*.62)},1181,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,1185,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1184,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1185,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1186,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1186,[17,777,858,1187,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1187,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1188,[812,1033,1183,17,1189,219,385,409,85,1191,1192,1193,777,816,876,851,1034,804,889,1199,1184,1057,1035,1194,856,1195,1200,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1189,[17,385,85,1190,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1190,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1191,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1192,[17,85,777,812,876,851,1191,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1193,[812,1191,17,385,85,777,884,876,1071,863,804,1184,1057,1194,856,1195,1192,1196,1198,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1194,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1195,[17,85,777,876,1008,1033,1064,1062,1194,804,856,1193,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1196,[1034,1197]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1197,[1034,1191]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1198,[17,85,777,812,1033,1034,1196,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1199,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1197,1034,1201,1097,804,1188,1057,1051,1191,1196,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1185,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1186,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1187,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1187,[17,777,858,1188,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1188,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1189,[812,1033,1183,17,1190,219,385,409,85,1192,1193,1194,777,816,876,851,1034,804,889,1185,1184,1057,1035,1195,856,1196,1200,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1190,[17,385,85,1191,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1191,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1192,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1193,[17,85,777,812,876,851,1192,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1194,[812,1192,17,385,85,777,884,876,1071,863,804,1184,1057,1195,856,1196,1193,1197,1199,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1195,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1196,[17,85,777,876,1008,1033,1064,1062,1195,804,856,1194,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1197,[1034,1198]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1198,[1034,1192]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1199,[17,85,777,812,1033,1034,1197,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1198,1034,1201,1097,804,1189,1057,1051,1192,1197,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1201,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1193,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1196,1198,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1194,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1197,1199,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1203,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1204,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1205,[17,85,777,876,1059,804,1071,8]); @@ -1326,9 +1326,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1243,[824,1244,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1244,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1245,[17,856,1242]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1191,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1247,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1187,848,995,998,1076,1107,1251,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1188,848,995,998,1076,1107,1251,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1249,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1250,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1251,[17,385,85,862,863,1033,1252,804,777,779,8]); @@ -1359,7 +1359,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1276,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1277,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1278,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1191,8]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1280,[17,85,1281,777,858,920,1260,1263,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},1281,[17,85,1282,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1282,[1283]); @@ -1420,7 +1420,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1186,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1480,7 +1480,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1190,1172,385,85,995,998,862,863,804,777,1401,1404,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); @@ -1499,13 +1499,13 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1194,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1191,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1187,1405,862,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1188,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); @@ -1513,8 +1513,8 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1186,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1194,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1189,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1188,926,927,876,1442,1395,998,1443,1005,1142,892,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

${i(o)} \xb7 ${c.label} \xb7 cut along the dashed lines \xb7 print at 100% (actual size, not "fit to page")

${u.join('')}`}},1437,[843,1285]); @@ -1533,7 +1533,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMo __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1189,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); @@ -1555,7 +1555,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esMo __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1191,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); __d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); @@ -1563,13 +1563,13 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1186,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1187,853,1184,884,1361,998,843,1115,1185,1206,1071,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1194,1486,1509,1457,1510,1511,17,1185,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1189,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1191,1485,1057,8,260]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); __d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); @@ -1591,7 +1591,7 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours and paydays, and the team tips pot). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); __d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); @@ -1635,7 +1635,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.UseOnComputerPage=function(){const[e,n]=(0,o.useState)(null),[f,y]=(0,o.useState)(''),[b,x]=(0,o.useState)(!1);return(0,p.jsxs)(t.default,{style:{gap:12},testID:"use-on-computer",children:[(0,p.jsx)(r.T,{weight:"semibold",center:!1,children:"CoverCharge for desktop, for owners on a Mac or PC"}),(0,p.jsx)(r.Muted,{center:!1,children:"The same account, bookings and permissions as this phone, on a big screen: wide booking and hours tables you can sort, filter and download, and larger takings and GP charts."}),(0,p.jsxs)(t.default,{style:{gap:4},children:[(0,p.jsx)(r.T,{size:14,center:!1,children:"1. On the computer, open Chrome, Edge or Safari and go to the CoverCharge website\u2019s /desktop page."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"2. Here, tap Make a sign-in link, then Share or copy it to yourself."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"3. Open the link on the computer, or type the code into the sign-in box."})]}),(0,p.jsx)(r.Muted,{center:!1,children:"The link works once, for 10 minutes. This phone stays signed in, and your personal link isn\u2019t changed."}),(0,p.jsx)(r.Button,{label:b?'Making a link\u2026':e?'Make a new sign-in link':'Make a sign-in link',disabled:b,onPress:async()=>{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1189,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); @@ -1665,7 +1665,7 @@ __d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); __d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1189,1458,1202,1185,1483,1186,878,1212,1213,884,776,899,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); diff --git a/owner-app/admin.html b/owner-app/admin.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/admin.html +++ b/owner-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer.html b/owner-app/customer.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer.html +++ b/owner-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage.html b/owner-app/customer/anchorage.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage.html +++ b/owner-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/book.html b/owner-app/customer/anchorage/book.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/book.html +++ b/owner-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/feedback.html b/owner-app/customer/anchorage/feedback.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/feedback.html +++ b/owner-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/gift.html b/owner-app/customer/anchorage/gift.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/gift.html +++ b/owner-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/lost.html b/owner-app/customer/anchorage/lost.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/lost.html +++ b/owner-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/loyalty.html b/owner-app/customer/anchorage/loyalty.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/loyalty.html +++ b/owner-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/merch.html b/owner-app/customer/anchorage/merch.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/merch.html +++ b/owner-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/offers.html b/owner-app/customer/anchorage/offers.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/offers.html +++ b/owner-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/refer.html b/owner-app/customer/anchorage/refer.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/refer.html +++ b/owner-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/waitlist.html b/owner-app/customer/anchorage/waitlist.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/waitlist.html +++ b/owner-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/whatson.html b/owner-app/customer/anchorage/whatson.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/anchorage/whatson.html +++ b/owner-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/basket.html b/owner-app/customer/basket.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/basket.html +++ b/owner-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/profile.html b/owner-app/customer/profile.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/customer/profile.html +++ b/owner-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/demo.html b/owner-app/demo.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/demo.html +++ b/owner-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/display.html b/owner-app/display.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/display.html +++ b/owner-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/index.html b/owner-app/index.html index 3d77bfaaaaef04149f5924f1e70526b1fd095217..dcb58a545a285cb97339b4a3c2dfecc501adc093 100644 --- a/owner-app/index.html +++ b/owner-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/kitchen.html b/owner-app/kitchen.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/kitchen.html +++ b/owner-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/owner.html b/owner-app/owner.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/owner.html +++ b/owner-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/staff.html b/owner-app/staff.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/staff.html +++ b/owner-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/sw.js b/owner-app/sw.js index f0003ff65b44d6392a922cefa9f9e57e35e0275a..282bc4602058335b8002b07a31e0108422359db3 100644 --- a/owner-app/sw.js +++ b/owner-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Manager service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-owner-b86fa063d0"; +const V = "cc-owner-840133f7f1"; const BASE = "/owner-app/"; -const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=b86fa063d0c111c6dbff9538456e4ccbf1e72aae8c182bf74dbe0c9a364deed4"]; +const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=840133f7f1292c61d8b09498e84f026d0b8546c38da05d97ad28fe74eda9f4d7"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/owner-app/team.html b/owner-app/team.html index 639e5d4621509fbc893117c9860e3e0fd77c8185..978e707d86e346a1e02c689d396e29daf1b16c6b 100644 --- a/owner-app/team.html +++ b/owner-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/_expo/static/js/web/bundle.js b/owner-desktop/_expo/static/js/web/bundle.js index da8f08f7df0a443a8b1b0abda42a77d02778d14a..bd9b09fb2c80a5270673967e27fa750183a42b83 100644 --- a/owner-desktop/_expo/static/js/web/bundle.js +++ b/owner-desktop/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1185,1188,1199,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1182,1186,1189,1185,1202,1207,1209,1210,1028,884,920,1212,1157,1213,1225,1230,1239,1232,1155,1241,1245,1203,858,1153,899,1246,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1262,27 +1262,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_DELIVERY_NOTE",{enumerable:!0,get:function(){return t}});const t=null},1179,[]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpOverTime=function({rid:e,width:b}){const $=(0,n.useGpCalcView)(),P=(0,o.useRecipeCards)(e),[w,k]=(0,s.useState)('3m'),[v,D]=(0,s.useState)(b??0),_=(0,s.useMemo)(()=>P.map(e=>({id:e.id,dish:e.dish,price:e.price})),[P]),M=(0,s.useMemo)(()=>(0,a.menuGp)($.ingredients,$.cardCosts??{},_,$.settings),[$.ingredients,$.cardCosts,_,$.settings]),G=(0,s.useMemo)(()=>(0,a.gpHistory)(Object.values($.deliveries??{}),M,w),[$.deliveries,M,w]),T=(0,s.useMemo)(()=>M.dishes.map(e=>{const s=G.points.find(s=>null!=s.dishes[e.id])?.dishes[e.id];return{...e,ch:null!=s?e.gp-s:0}}).sort((e,s)=>Math.abs(s.ch)-Math.abs(e.ch)),[M.dishes,G.points]),[A,I]=(0,s.useState)(null),C=(A??T.slice(0,3).map(e=>e.id)).filter(e=>T.some(s=>s.id===e)).slice(0,3),L=(0,a.gpSummary)(G.points,w),F=240,S=(0,s.useMemo)(()=>v>0?(0,u.gpChartLayout)(v,F,G.points,C,M.dishes.map(e=>e.target)):null,[v,G.points,C,M.dishes]),z=e=>M.dishes.find(s=>s.id===e)?.name??G.names[e]??'Dish';return(0,p.jsxs)(d.Box,{testID:"gp-over-time",children:[(0,p.jsx)(r.T,{size:20,weight:"bold",center:!0,colour:c.colours.gold,accessibilityRole:"header",children:"GP over time"}),(0,p.jsx)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['4w','3m','12m'].map(e=>(0,p.jsx)(h.Pick,{testID:`gp-range-${e}`,label:a.RANGE_SAID[e],accessibilityLabel:`Show ${a.RANGE_SAID[e]}`,selected:w===e,onPress:()=>k(e)},e))}),(0,p.jsxs)(t.default,{testID:"gp-summary",accessible:!0,accessibilityLabel:L,accessibilityLiveRegion:"polite",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(r.T,{size:30,weight:"bold",center:!0,colour:m,children:null!=M.menu?`${M.menu.toFixed(1)}%`:'\u2014'}),(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:L.replace(/^Menu GP now [\d.]+ percent, ?/,'').replace(/\.$/,'')||'Menu GP'})]}),(0,p.jsx)(t.default,{testID:"gp-chart",onLayout:b?void 0:e=>D(Math.floor(e.nativeEvent.layout.width)),importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{width:'100%',height:F,alignItems:'center'},children:S?(0,p.jsxs)(l.default,{width:S.width,height:F,children:[S.yTicks.map(e=>(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:e.y,y2:e.y,stroke:c.colours.border,strokeWidth:1},`g${e.v}`)),S.yTicks.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:u.GP_LEFT_BAND-6,y:e.y+4,fontSize:12,fill:c.colours.muted,textAnchor:"end",children:`${e.v}%`},`y${e.v}`)),null!=S.target?(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:S.target,y2:S.target,stroke:y,strokeDasharray:"4 4",strokeWidth:1}):null,S.area?(0,p.jsx)(i.Path,{d:S.area,fill:y,fillOpacity:.18}):null,S.dishPaths.map((e,s)=>(0,p.jsx)(i.Path,{d:e.d,stroke:x,strokeWidth:2,strokeDasharray:f[s]||void 0,fill:"none"},e.id)),S.menuPath?(0,p.jsx)(i.Path,{d:S.menuPath,stroke:m,strokeWidth:3,fill:"none"}):null,S.menuDots.map((e,s)=>(0,p.jsx)(i.Circle,{cx:e.x,cy:e.y,r:3,fill:m},s)),G.markers.map((e,s)=>{const t=S.xOfWeek(e.week);if(null==t)return null;const l=F-u.GP_AXIS_BAND-2;return(0,p.jsx)(i.Polygon,{points:`${t-5},${l} ${t+5},${l} ${t},${l-8}`,fill:y},`${e.id}${s}`)}),S.xLabels.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:e.x,y:234,fontSize:12,fill:c.colours.muted,textAnchor:"middle",children:e.text},e.text+e.x))]}):null}),(0,p.jsxs)(r.Row,{wrap:!0,gap:12,style:{justifyContent:'center'},children:[(0,p.jsx)(j,{colour:m,label:"Menu GP"}),C.map((e,s)=>(0,p.jsx)(j,{colour:x,dash:f[s],label:z(e)},e)),(0,p.jsx)(j,{colour:y,label:"Delivery changed costs",tri:!0})]}),T.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:"Dishes on the chart (up to 3)"}),(0,p.jsx)(r.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:T.slice(0,12).map(e=>(0,p.jsx)(h.Pick,{testID:`gp-dish-${e.id}`,label:`${e.name} ${e.gp.toFixed(0)}%`,accessibilityLabel:`${e.name}, GP ${e.gp.toFixed(1)} percent${Math.abs(e.ch)>=.05?`, ${e.ch>0?'up':'down'} ${Math.abs(e.ch).toFixed(1)} points over ${a.RANGE_SAID[w]}`:', steady'}. ${C.includes(e.id)?'On the chart':'Tap to add to the chart'}`,selected:C.includes(e.id),onPress:()=>{return s=e.id,I(C.includes(s)?C.filter(e=>e!==s):[...C,s].slice(-3));var s}},e.id))})]}):(0,p.jsx)(r.Muted,{center:!0,children:"Cost your recipe cards to see dish GP here."}),G.markers.length?(0,p.jsxs)(t.default,{testID:"gp-markers",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,weight:"semibold",children:"Deliveries that changed costs"}),G.markers.slice(-5).reverse().map(e=>(0,p.jsxs)(r.T,{size:c.font.small,center:!0,colour:null!=e.change&&e.change<-.05?c.colours.amber:c.colours.muted,children:[e.date.split('-').reverse().join('/')," \xb7 ",e.supplier||'Supplier',null!=e.change?` \xb7 menu GP ${e.change>0?'+':''}${e.change.toFixed(1)} pts`:'']},e.id))]}):null]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=_r(_d[2]),l=e(i),r=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const m=c.colours.gold,x='#C9CCD1',y='#B0773B',f=['','6 4','2 4'];function j({colour:e,label:s,tri:n,dash:o}){return(0,p.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:6},accessible:!1,children:[(0,p.jsx)(l.default,{width:18,height:12,children:n?(0,p.jsx)(i.Polygon,{points:"4,11 14,11 9,2",fill:e}):(0,p.jsx)(i.Line,{x1:0,x2:18,y1:6,y2:6,stroke:e,strokeWidth:3,strokeDasharray:o||void 0})}),(0,p.jsx)(r.T,{size:c.font.small,colour:c.colours.muted,children:s})]})}},1180,[17,85,780,777,905,858,908,804,889,1157,1181,8]); __d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GP_AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GP_LEFT_BAND",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelW",{enumerable:!0,get:function(){return u}}),e.gpChartLayout=function(h,i,o,c,s){const d=Math.max(10,h-n-l),M=Math.max(10,i-t-a-12),f=o.flatMap(t=>[t.menu,...c.map(n=>t.dishes[n])]).filter(t=>null!=t),x=s.length?Math.round(s.reduce((t,n)=>t+n,0)/s.length):null;null!=x&&f.push(x);let p=f.length?5*Math.floor(Math.min(...f)/5)-5:50,b=f.length?5*Math.ceil(Math.max(...f)/5)+5:80;p=Math.max(0,p),b=Math.min(100,Math.max(b,p+10));const $=Math.max(1,o.length-1),y=t=>n+t/$*d,P=t=>a+M-(t-p)/(b-p)*M,_=b-p>30?10:5,F=[];for(let t=p;t<=b;t+=_)F.push({v:t,y:P(t)});const L=t=>{let n='',l=!1;return o.forEach((a,u)=>{const h=t(a);null!=h?(n+=`${l?'L':'M'}${y(u).toFixed(1)},${P(h).toFixed(1)}`,l=!0):l=!1}),n||null},w=L(t=>t.menu),O=o.findIndex(t=>null!=t.menu);let j=-1;o.forEach((t,n)=>{null!=t.menu&&(j=n)});const k=O>=0&&o.slice(O,j+1).every(t=>null!=t.menu),v=w&&k&&j>O?`${w}L${y(j).toFixed(1)},${P(p).toFixed(1)}L${y(O).toFixed(1)},${P(p).toFixed(1)}Z`:null,A=o.map((t,n)=>null!=t.menu?{x:y(n),y:P(t.menu)}:null).filter(t=>!!t),D=t=>`${t.slice(8,10)}/${t.slice(5,7)}`,E=u('00/00'),B=Math.max(2,Math.floor(d/(E+12))+1),G=Math.max(1,Math.ceil(o.length/B)),I=[];for(let t=o.length-1;t>=0;t-=G){const n=Math.min(h-E/2-2,Math.max(36+E/2,y(t)));I.some(t=>Math.abs(t.x-n)[t.week,n]));return{width:h,height:i,yTicks:F,menuPath:w,area:v,menuDots:A,xLabels:I,target:null!=x&&x>=p&&x<=b?P(x):null,dishPaths:c.map(t=>({id:t,d:L(n=>n.dishes[t])})).filter(t=>!!t.d),xOfWeek:t=>{const n=N.get(t);return null==n?null:y(n)}}};const t=24,n=40,l=10,a=12,u=(t,n=12)=>Math.ceil(t.length*n*.62)},1181,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1182,[812,1183,17,385,85,409,777,876,851,863,804,1184,1057,1035,840,1185,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1184,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1185,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1186,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1186,[17,777,858,1187,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1187,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1188,[812,1033,1183,17,1189,219,385,409,85,1191,1192,1193,777,816,876,851,1034,804,889,1199,1184,1057,1035,1194,856,1195,1200,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1189,[17,385,85,1190,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1190,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1191,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1192,[17,85,777,812,876,851,1191,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1193,[812,1191,17,385,85,777,884,876,1071,863,804,1184,1057,1194,856,1195,1192,1196,1198,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1194,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1195,[17,85,777,876,1008,1033,1064,1062,1194,804,856,1193,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1196,[1034,1197]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1197,[1034,1191]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1198,[17,85,777,812,1033,1034,1196,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1199,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1197,1034,1201,1097,804,1188,1057,1051,1191,1196,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1185,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1184,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1186,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1187,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1187,[17,777,858,1188,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1188,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1189,[812,1033,1183,17,1190,219,385,409,85,1192,1193,1194,777,816,876,851,1034,804,889,1185,1184,1057,1035,1195,856,1196,1200,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1190,[17,385,85,1191,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1191,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1192,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1193,[17,85,777,812,876,851,1192,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1194,[812,1192,17,385,85,777,884,876,1071,863,804,1184,1057,1195,856,1196,1193,1197,1199,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1195,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1196,[17,85,777,876,1008,1033,1064,1062,1195,804,856,1194,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1197,[1034,1198]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1198,[1034,1192]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1199,[17,85,777,812,1033,1034,1197,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1200,[1033,17,385,85,777,812,876,1198,1034,1201,1097,804,1189,1057,1051,1192,1197,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1201,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1193,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1196,1198,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1202,[813,876,1203,1070,1183,923,924,17,975,976,219,385,278,85,777,858,1071,1204,1194,1163,1205,1059,805,1206,1140,851,863,804,1184,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1197,1199,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1203,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1204,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1205,[17,85,777,876,1059,804,1071,8]); @@ -1326,9 +1326,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1243,[824,1244,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1244,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1245,[17,856,1242]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1246,[17,385,329,85,409,804,1191,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1247,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1187,848,995,998,1076,1107,1251,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1248,[843,1099,861,13,17,1249,917,85,841,1250,1079,1055,777,845,851,1105,863,858,899,804,1188,848,995,998,1076,1107,1251,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1249,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1250,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1251,[17,385,85,862,863,1033,1252,804,777,779,8]); @@ -1359,7 +1359,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1276,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1277,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1278,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1190,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1279,[17,385,85,409,777,804,1191,8]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1280,[17,85,1281,777,858,920,1260,1263,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},1281,[17,85,1282,804,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1282,[1283]); @@ -1420,7 +1420,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1186,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1480,7 +1480,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1190,1172,385,85,995,998,862,863,804,777,1401,1404,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); @@ -1499,13 +1499,13 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1194,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1191,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1187,1405,862,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1188,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); @@ -1513,8 +1513,8 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1186,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1194,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1189,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1188,926,927,876,1442,1395,998,1443,1005,1142,892,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

${i(o)} \xb7 ${c.label} \xb7 cut along the dashed lines \xb7 print at 100% (actual size, not "fit to page")

${u.join('')}`}},1437,[843,1285]); @@ -1533,7 +1533,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMo __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1189,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); @@ -1555,7 +1555,7 @@ __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esMo __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1191,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); __d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); @@ -1563,13 +1563,13 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1186,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1187,853,1184,884,1361,998,843,1115,1185,1206,1071,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1194,1486,1509,1457,1510,1511,17,1185,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1189,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1191,1485,1057,8,260]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); __d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); @@ -1591,7 +1591,7 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours and paydays, and the team tips pot). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); __d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); __d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); @@ -1635,7 +1635,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.UseOnComputerPage=function(){const[e,n]=(0,o.useState)(null),[f,y]=(0,o.useState)(''),[b,x]=(0,o.useState)(!1);return(0,p.jsxs)(t.default,{style:{gap:12},testID:"use-on-computer",children:[(0,p.jsx)(r.T,{weight:"semibold",center:!1,children:"CoverCharge for desktop, for owners on a Mac or PC"}),(0,p.jsx)(r.Muted,{center:!1,children:"The same account, bookings and permissions as this phone, on a big screen: wide booking and hours tables you can sort, filter and download, and larger takings and GP charts."}),(0,p.jsxs)(t.default,{style:{gap:4},children:[(0,p.jsx)(r.T,{size:14,center:!1,children:"1. On the computer, open Chrome, Edge or Safari and go to the CoverCharge website\u2019s /desktop page."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"2. Here, tap Make a sign-in link, then Share or copy it to yourself."}),(0,p.jsx)(r.T,{size:14,center:!1,children:"3. Open the link on the computer, or type the code into the sign-in box."})]}),(0,p.jsx)(r.Muted,{center:!1,children:"The link works once, for 10 minutes. This phone stays signed in, and your personal link isn\u2019t changed."}),(0,p.jsx)(r.Button,{label:b?'Making a link\u2026':e?'Make a new sign-in link':'Make a sign-in link',disabled:b,onPress:async()=>{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1189,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); @@ -1665,7 +1665,7 @@ __d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); __d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1189,1458,1202,1185,1483,1186,878,1212,1213,884,776,899,8]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); diff --git a/owner-desktop/index.html b/owner-desktop/index.html index 137d72cd3966e55117a4df9d70d58799a1ae3ead..51290114e46a6da688aa146f629752f47dee15ff 100644 --- a/owner-desktop/index.html +++ b/owner-desktop/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/owner.html b/owner-desktop/owner.html index e69b59301e2fa047505d74d80686f16bef995e58..aed5fc9dcee8c479b24b6bd8c99f28a2be104479 100644 --- a/owner-desktop/owner.html +++ b/owner-desktop/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/sw.js b/owner-desktop/sw.js index 48ad6e1527f78db1b14ebff4ee1d323789b22393..daad13b50b8cba1b8259ff368b02600bc408159d 100644 --- a/owner-desktop/sw.js +++ b/owner-desktop/sw.js @@ -1,7 +1,7 @@ // Anchorage owners desktop service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-desk-1b785ca324"; +const V = "cc-desk-ab49ae75c5"; const BASE = "/owner-desktop/"; -const PRECACHE = ["/owner-desktop/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-desktop/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-desktop/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-desktop/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-desktop/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-desktop/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-desktop/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-desktop/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-desktop/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-desktop/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-desktop/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-desktop/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-desktop/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-desktop/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-desktop/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-desktop/favicon.ico", "/owner-desktop/index.html", "/owner-desktop/_expo/static/js/web/bundle.js?v=1b785ca324caa33e44136308372961daf5d587c4bc2458cf83131c39f08022f4"]; +const PRECACHE = ["/owner-desktop/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-desktop/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-desktop/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-desktop/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-desktop/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-desktop/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-desktop/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-desktop/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-desktop/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-desktop/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-desktop/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-desktop/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-desktop/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-desktop/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-desktop/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-desktop/favicon.ico", "/owner-desktop/index.html", "/owner-desktop/_expo/static/js/web/bundle.js?v=ab49ae75c5ecd0b1751873123ff530791cf9e2bea0f6e7df76be297af281d693"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/staff-app/_expo/static/js/web/bundle.js b/staff-app/_expo/static/js/web/bundle.js index d419555530fa9928e8719e8055d0e344809bd830..e93d3dda20f80f938227a2f8751993ea475d2908 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -855,7 +855,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},772,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},774,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1179,1182,1193,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1219,1220,1229,1222,1155,1231,1235,1197,858,1153,899,1236,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:G}=(0,V.useChef)(3e4);(0,je.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),J=_?.id??V.CHEF_ID,X=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',ve=(0,Te.useSync)(e=>e.perms),Ce=ve.includes('*')||ve.includes('takings.view');(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Be=e?He[e]:void 0,[$e,Oe]=(0,A.useState)(Be?.tab??'home'),[Ee,Le]=(0,A.useState)(Be?.k??null),[Ne,We]=(0,A.useState)(Be?.stock??'levels'),[Fe,Ge]=(0,A.useState)(void 0),[Ke,Me]=(0,A.useState)(Be?.gp??'dishes'),Ve=(0,A.useRef)(null),ze=(0,y.ymd)(G),Ue=(0,y.ymd)(new Date(G.getTime()+864e5));(0,p.useTipsPosted)(i,ze);const qe=(0,se.useTravelDay)('chef',ze),Qe='home'===$e&&!qe;(0,S.useKitchenTodoChime)(i,ze,()=>Ze('kitchen','bookings')),(0,ye.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),G)},[]);const Ye=(0,A.useRef)({t:'home',k:null});Ye.current={t:$e,k:Ee};const Je=(0,A.useRef)([]),Xe=(0,r.useScrollMemory)(Ve),Ze=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Ce||(t=null);const s=Ye.current;s.t===e&&s.k===t||(Je.current=[...Je.current,{...s,y:Xe.leave()}].slice(-30),Xe.restore(0)),Oe(e),Le(t)},[Ce]),et=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Ye.current;let t=Je.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Je.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return Xe.leave(),Oe(s.t),Le(s.k),Xe.restore(s.y??0),!0},[]);(0,l.useWebBack)(et);const tt=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&We(s),'gp'===e&&s&&Me(s),Ze(e,t)})},[Ze]),(0,f.useShiftReminders)({rid:i,staffId:J,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ze('kitchen','orderlists'),'chat'===e&&Ze('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',et);return()=>e.remove()},[et]),(0,A.useEffect)(()=>{'takings'!==Ee||Ce||(Le(null),Oe('kitchen'))},[Ee,Ce]),(0,Te.useSync)(e=>e.perms.join(','));const st=(0,H.kitchenHistoryAccess)(i),it=De.filter(e=>('takings'!==e.id||Ce)&&('bookinghistory'!==e.id||st)&&('kitchensetup'!==e.id||st)),at=Ee&&('takings'!==Ee||Ce)?De.find(e=>e.id===Ee):null,ot=((0,E.default)().width,at?at.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:pe.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[$e]);return(0,Se.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:K.colours.bg},edges:['top','bottom'],children:[(0,Se.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:K.colours.border,gap:6},children:[(0,Se.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'100%'},children:[(0,Se.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${X?`, ${X}`:''}`,style:{borderWidth:1,borderColor:K.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Se.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Se.jsx)(ce.StaffAvatar,{id:V.CHEF_ID,size:24,ring:!1}),(0,Se.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Se.jsxs)(F.T,{size:13,weight:"semibold",colour:K.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),X?(0,Se.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:X}):null]})]})}),(0,b.openedFromDisplay)()?(0,Se.jsx)(b.BackToDisplayButton,{compact:!0}):null]}),(0,Se.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ue.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:K.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Se.jsx)(F.T,{size:13,colour:K.colours.gold,children:"Staff app \u203a"})})]}),(0,Se.jsxs)(O.default,{ref:Ve,...Xe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===$e?(0,Se.jsx)(de.AlertsBanner,{}):null,'home'===$e?(0,Se.jsx)(le.WhosOnShift,{}):null,(0,Se.jsx)(l.BackTitleRow,{back:!('home'===$e&&!Ee||tt),onBack:et,title:ot}),'home'===$e?(0,Se.jsx)(se.DayBar,{app:"chef",today:ze}):null,'home'===$e&&qe?(0,Se.jsx)(se.DayView,{rid:i,day:qe,today:ze,app:"chef"}):null,'home'===$e?(0,Se.jsx)(re.WhoBar,{}):null,Qe&&_?(0,Se.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,G.getTime()).on}):null,Qe&&(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TodaysTipsCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(p.TipsPotCard,{rid:i,today:ze}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(x.CoversToday,{rid:i,onPress:()=>Ze('kitchen','bookings')}):null,Qe?(0,Se.jsx)(j.LastFoodBanner,{rid:i,now:G}):null,Qe?(0,Se.jsx)(w.NextTableFreeCard,{rid:i,now:G}):null,Qe?(0,Se.jsx)(v.KitchenSignoffs,{rid:i,today:ze,by:n,app:"chef"}):null,Qe?(0,Se.jsxs)(L.default,{style:{gap:4},children:[(0,Se.jsx)(v.PlattersBooked,{rid:i,date:ze,label:"Platters booked today"}),(0,Se.jsx)(v.PlattersBooked,{rid:i,date:Ue,label:"Platters booked tomorrow"})]}):null,Qe&&!(0,k.isKitchenViaDisplay)()?(0,Se.jsx)(Ae,{go:(e,t)=>{'stock'===e&&t&&We(t),'gp'===e&&t&&Me(t),'orders'===e&&Ge(t),Ze(e,'kitchen'===e?t??null:null)}}):null,'stock'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Ne?'deliveries':'take'===Ne?'count':'deliveries'},`s-${Ne}`),'gp'!==$e||c.PITCH?null:(0,Se.jsx)(ee.KitchenCosts,{rid:i,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ke}`),'stock'===$e&&c.PITCH?(0,Se.jsx)(Z.StockScreen,{initial:Ne},Ne):null,'gp'===$e&&c.PITCH?(0,Se.jsx)(z.GpScreen,{initial:Ke},Ke):null,'creator'===$e?(0,Se.jsx)(pe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===$e?(0,Se.jsx)(Q.OrdersScreen,{focus:Fe},Fe??'all'):null,'rota'===$e?(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(Y.KitchenRotaTab,{today:ze})}):null,'kitchen'!==$e||at?null:(0,Se.jsxs)(L.default,{style:{gap:10},children:[(0,Se.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:K.colours.border,backgroundColor:K.colours.surface,overflow:'hidden'},children:[Re.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Ze(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id)),it.map(e=>(0,Se.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ze($e,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:K.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Se.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,Se.jsxs)(L.default,{style:{flex:1},children:[(0,Se.jsx)(F.T,{weight:"medium",children:e.title}),(0,Se.jsx)(F.Muted,{children:e.sub})]}),(0,Se.jsx)(F.T,{colour:K.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Se.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Se.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Te.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ee&&J?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Se.jsx)(oe.ClockInOut,{}),(0,Se.jsx)(ne.MyUpcomingShifts,{staffId:J,team:!0})]}):null,'mypay'===Ee?(0,Se.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Se.jsx)(ie.MyPeriods,{staffId:J}),(0,Se.jsx)(te.MyHoursPay,{staffId:J}),(0,Se.jsx)(ae.MyTips,{staffId:J}),(0,Se.jsx)(F.Card,{children:(0,Se.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ee?(0,Se.jsx)(L.default,{testID:"chef-alerts",children:(0,Se.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ee?(0,Se.jsx)(t.AvatarMaker,{meId:_?.id??V.CHEF_ID,me:n}):null,'reviews'===Ee?(0,Se.jsx)(xe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ee?(0,Se.jsx)(R.BookingHistory,{rid:i,today:ze}):null,'bookings'===Ee?(0,Se.jsx)(I.TodaysBookings,{rid:i,today:ze,by:n,app:"chef"}):null,'specials'===Ee?(0,Se.jsx)(ke.SpecialsEditor,{rid:i,me:n,app:"chef",now:G}):null,'forecast'===Ee?(0,Se.jsx)(U.ChefForecast,{openPrep:()=>Ze('kitchen','prep')}):null,'prep'===Ee?(0,Se.jsx)(q.PrepScreen,{}):null,'live'===Ee?(0,Se.jsx)(q.TeamScreen,{}):null,'waste'===Ee?(0,Se.jsx)(q.WasteScreen,{}):null,'recipes'===Ee?(0,Se.jsx)(me.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ee?(0,Se.jsx)(q.AllergenScreen,{openCards:()=>Ze('kitchen','recipes')}):null,'takings'===Ee&&Ce?(0,Se.jsx)(p.CashUpScreen,{rid:i,today:ze,canEdit:!1,chartsOnly:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'board'===Ee?(0,Se.jsx)(we.QuestionBoard,{rid:i,today:ze,manager:!1,by:""}):null,'teamtasks'===Ee?(0,Se.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Ee?(0,Se.jsx)(C.OrderListsScreen,{rid:i,today:ze,editor:!0,who:{id:J,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ee?st?(0,Se.jsx)(D.TempUnitsSetup,{}):(0,Se.jsx)(F.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ee||'compliance'===Ee||'foodsafety'===Ee?(0,Se.jsx)(ge.HaccpLog,{mode:"chef",me:n,meId:V.CHEF_ID,now:G,rid:i}):null,'accidents'===Ee?(0,Se.jsx)(he.AccidentBook,{app:"chef",me:n,meId:V.CHEF_ID,now:G,seeAll:!1}):null]}),(0,Se.jsx)(Pe.BottomTabs,{tablist:!0,background:K.colours.surface,active:'orders'===$e?'kitchen':$e,onPress:e=>Ze(e),tabs:Ie.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Se.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Se.jsx)(fe.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),be=_r(_d[67]),fe=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ie=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:pe.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Re=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],De=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, the team tips pot, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],He={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ae({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,V.useChef)(3e4),d=(0,J.useSheetReminders)(),u=(0,V.useWeek)(),{covers:h,label:p,enough:k,booked:b}=(0,V.useForecast)(),f=(0,Q.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,V.isLow)(e.onHand,e.par)),x=f.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,ve.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,ee.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Se.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Se.jsx)(ge.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Se.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Se.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Se.jsx)(X.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Se.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Se.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,V.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Se.jsx)(V.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,V.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,V.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,G.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Se.jsx)(V.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,G.gbp)((0,V.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Se.jsx)(V.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Se.jsx)(V.Tile,{label:"Waste this week",value:t.waste.length?(0,G.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,V.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Se.jsx)(V.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Se.jsx)(V.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Se.jsx)(V.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Se.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Se.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Se.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Se.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Se.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[pe.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Se.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:K.colours.gold,backgroundColor:K.colours.surface},children:(0,Se.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Se.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Se.jsx)(Ce.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},775,[776,890,869,891,898,1025,1026,978,880,1027,1031,1032,922,1065,1066,863,1072,1074,1075,1078,1081,1084,1086,1087,1088,1126,1128,1063,17,356,219,385,278,409,85,19,857,777,851,804,1057,1138,1144,1147,1148,1151,1169,1166,1170,1171,1174,1175,1176,1180,1183,1179,1196,1201,1203,1204,1028,884,920,1206,1157,1207,1219,1220,1229,1222,1155,1231,1235,1197,858,1153,899,1236,8]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},776,[17,319,219,385,85,777,884,888,885,804,889,8]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=v,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,R.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,R.jsx)(F,{}):null]});return(0,R.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,R.jsx)(v,{title:t,subtitle:r,back:o,right:l})}),c?(0,R.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,R.jsx)(p.default,{style:{flex:1},children:u}),s?(0,R.jsx)(p.default,{style:N.footer,children:(0,R.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=H,_e.Card=E,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,R.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:T?'center':'flex-start'}],children:(0,R.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=V,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return O}}),_e.Row=_,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return M}}),_e.Field=function({label:e,money:t,onChangeText:r,...l}){return(0,R.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,R.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t?{keyboardType:'decimal-pad',inputMode:'decimal'}:{},...l,onChangeText:t&&r?e=>r((0,B.sanitiseMoneyTyping)(e)):r,style:[N.input,l.multiline&&{minHeight:70,textAlignVertical:'top'},l.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,R.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,R.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,R.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,R.jsxs)(_,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,R.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,R.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,R.jsxs)(_,{gap:10,children:[(0,R.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,R.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,R.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,R.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,R.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w,onTypingDone:W,typingDoneLabel:k}){const{height:S}=(0,x.default)(),I=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=(0,r.useTyping)(),T=(0,r.useVisibleArea)(),P=B&&T&&T.height{W?W():(0,r.hideKeyboard)()},testID:"sheet-done",hitSlop:6,style:({pressed:e})=>({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,R.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,D?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,R.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,R.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,R.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,R.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,R.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]),R=_r(d[24]);const D=['kirkton','abbotsford'].includes(k.VENUE_RID),T='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(T&&('semibold'===l||'bold'===l)&&!j);return(0,R.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,R.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),A=e=>(0,R.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,R.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??T});function v({title:e,back:t=!0,right:r,subtitle:o}){return(0,R.jsxs)(p.default,{style:N.brandBar,children:[(0,R.jsxs)(p.default,{style:N.row,children:[(0,R.jsx)(p.default,{style:N.brandSide,children:t?(0,R.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,R.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,R.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,R.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,R.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,R.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,R.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,R.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function F(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,R.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,R.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function H({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,R.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,R.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,R.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function E({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,R.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function V({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,R.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,R.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,R.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,H.centreRow=!0;const $=({phone:e})=>(0,R.jsx)(V,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),O=()=>(0,R.jsx)(V,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function _({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===E?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(T&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,R.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=T&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,R.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const M=()=>(0,R.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},777,[778,779,815,812,13,816,17,362,378,219,385,278,24,393,85,409,19,804,811,855,805,856,857,840,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},778,[]); @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.214'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1116,7 +1116,7 @@ __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esMod __d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},1033,[]); __d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1034,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1035,[17,860,1036,1037,1034]); -__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1036,[824,831,834]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},replay:null,markStep:(t,s,p)=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},steps:{...e.setup[t]?.steps??{},[s]:p}}}})),welcome:t=>e(e=>({setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:n()}}})),finish:t=>e(e=>({replay:null,setup:{...e.setup,[t]:{...e.setup[t]??{steps:{}},welcomed:e.setup[t]?.welcomed??n(),finished:n()}}})),restart:t=>e(e=>({setup:{...e.setup,[t]:{steps:{}}}})),setReplay:t=>e({replay:t}),saveAnswers:(t,s)=>e(e=>({answers:{...e.answers,[t]:s}}))}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>s.default),partialize:e=>({setup:e.setup,answers:e.answers})}))},1036,[824,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return t}});const t={anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:r(d[0]).ANCHORAGE_PAY}}},1037,[838]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1038,[219,928,899,1039]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1039,[482,1040,1042,1041]); @@ -1256,27 +1256,27 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STOCK_ICON_IMAGES",{enumerable:!0,get:function(){return A}});const A={'\ud83e\udd9e':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAABACAYAAACKhS4jAAAZTUlEQVR42rV6eXxcxZXud6ruvb2r1ZJarW6ttpGxZeMlZjWLbTBbgIQQZIckjxAYYHgEQjIJPDKZkc2E/DIhCZM3GSCQeQSSEAaxOazBBmwcbGyQF+IN28KLrM3ae1N331t15o/uNrItOWbycn+/+2vLt27VV+d+56tzThXwV1zPAJLzt2BAtgDiBM2p0JYKt2BAFh8yQADwy1Co7s9V0cc3RaI/uwehYOGZOGlQYzoXJ2oz3v9PNAGa4M9iP28DBgCsKQ9/h+samGsbuCsSe/2HgUD5RP0a41mTAJXvd0ILggB+uaJiXgTG5QlwdYCw/eVk/Pnlo6NdLYBYDuhi+xaAlgP0UlnF1xpM4yof4BtmdPRp5wnq738HAPUVxhti1Z5VyhGAjlrmpdfB91+bE8GrluFQdhlANBGu4uz+saRkyoGq6t92RKK/bgL8Y61V/BprKyvvGqmpTXDdJOa6Bua6Bu6sim17vLx8Go1pV/xdHw4v59p65tp6TsZqmOsaOB6rTb8cLF9UaCcB4I4ylPTFqj/WNXWcjdVkubaet4Yjj4xpQ+PyFwDu94VmdkWrP+K6Bk7GavhmT8kZxYkxIAjAy6GKK9LVtcw19by3MvrS2nDk/uForJ3rJ/HOyuhzCwCDAVE0xu8rKqbGq2tSo7G6dFtF5bf/3Rc6bXck9iTXNXB7VfTxIrDiBNrCkfu4po6zsVrbrq51cjV1vDkc+fpYeh1lcQJwg9tduz8S28G19czVtU4iVnPgSkS9Y/0AAPVEY6u5toG3lEf+pUi9p4LBuSPR6s5MrDb7pLd0duEdEwB+H6q4hWsb+EA0+svimHdY/qZkdW1yqLpu4wLAXaCjyYB4saysaShW06er6zhTXeNwTZ3uj1Z3/UswOInBdIT/BVDyDsC1NxJdwbX1nInVZLiugbdWRp8stDGaC1a5ze+fnohVp/tj1W0AXBLAvvp6NwDsicQe5LoGfjUU/k7hPQsAuiOxR+zaOn4jHL6mMJ4BgHLVtR8djFZ3zwdixzJhdyTyBNfWc7a61snFamyuqecPw1WPjqWYQN7q6vNl4ZsnmebnHK0cQSRZawit13DeSZxnClz7fiAw1SsNz66s8woBWQcw3j9wwGZA7HCyq3Na43yPaxYAoKkJAFBlmmVJzc5rqVR7weGYADYBxYBMAbS2LhjaXFn1zN5I1WMA8LGt/5DTGhIQIBIazNWmsfTRUGiGKLwnCFB3+P3hWS7zOwIEzSCTyBhQamilSr5HAD8cCDQ2FOgRgfQJIgRN2sMArQbQnAejX8rldmY0RnNANQBgxwwFAP3slEogU+/SQwDQWpCyEa21JMJWYEhn3XPnuF3NUyzX371fEb3pssG+V1JadUkiYoAUsy6TsuR8y7qzIDcsAOAmr/eLFdKoz7HWRFSgE3307aHUnl2V0R8vDZavfjlc9XUA6NO2SzMjTNQDgBcWLAkAP/P7B0uEGBphXQkgALRqALA1mwDBHnUfpRTrnNFlCVbfB5Ae1bompbQNZl1r0M0AnC7Nq0ACAGsAAsxcLYzmB4PBBgK0aAGMkJBX5CdYAEIChxz7zR8EAp9pNI3vhgixMikXAUAf86t/SCWufUDrdQX9LOo52tJpx4EeFQwXCs5a4OZR2ry98Pdn+wafnd7d/SgAKAVIgqGYOSDknMeCFbMrhHxRg0H5L0s2sw4YRuhCy70EAER9IDCp1DBmQ2sigMBMAKPOEG03+nxXCSEYrPWI1mEArlmHD/d+YXDwuZ/29qaKiyQVnGfRyMhon+P0uwCPHxDGGNAMCIeZjpXnbQWnNoXs1wzNzMorhetyj7Hw/w3G/zzoOFmDhKGLfTGjxjCv+VEoFBSmlNOV0lWaCAyQIBJZrfBSJnPYQ3JyYVEQLkLoPMDL+RXTOHax4E9WXzaBirsDgdCRJRaCLUL6glJ3GgCWFZovAdSO/GoON0ELQDNAIIJN8szNlMuRED1UWNEZEApgizB7qsR8caU7MCUopam0VgAgiSjNnFqRydjDmo9ImIfIf4HH4yWAl50gfChOwiiEEQBMm+F1E2Xmu1z2se2bC6+cZtBhi5DTgMHMcDRPnupySQmMgrlIP9Jaa78Q7jmm91yRgKoTeasfuRymzA5HZASxCwAcgEulKPlKWZm3YDmaMHQs9vHJP4M2uAxgjjvOccHVssLv8+n0cL+jMxYJIs2IkpjkSguvDyIFoiN2YQKYCCOaZ4oBrfOyRgWdYYYL7LvYizIH5DAAh1mbRCWnELnHDjgBfE3Hf4yJgjwsL/jMTSMjAyOsD4EImw3F73tVWaBGPL3eyjU5+dCzMHESlMc4WSjm0NiRHYA9Qri/nPXmgowDxAQ3Q+eYrd+m05GCTh9redb5zjPdSnWUGIbrK75gyfjR8PFM0/k2I0EhOkYFY6tl6/2GokmWNbOEyVPgxVH9lAoKGx4SJWDOO2ve8HAkoasS9/QL1VgnbMRsIKwkBSCnA1jVfAIkDqAMIRAtUO6kruZmgdZWFRSi19KEq0ZNOCzgAasSkFBjgIv8goUKkpXCR6KqOC0GYBBoBBraIz+XtDB9vWljn9SCBOEit9VYGGxCHLLweR0QMyB8gCBoaAaPJMX49GltBQB8mM12EAPlLDhiavhZSOcTxz+Kh1KQMBJadYGMOjAzAaQAhLXARSlD28QkQeTTeREkiGhhsHFANBPQCgjuBQhusCgsYDmLyDWoVN8/xDtH6QQ82q3UnrmKQackBOqTwAcVQNzKB8s8BjiAUa3TIkccP17uGOVMokoJCiuCCSIQYVA71QDcMg+KJlCbJMA4JHR8RVnZ1y4zPNM0I+Vo6NaCph9n+MLvGYbY4RhOVkZSJH0OU00SUOIof2eABRG6lXNIBA3ZUVgCjrKmDcCm/K3zKy8MoOYrXm9In0g+mEyHGSnbvvFSt+/RR8tLn/QTxZjgYIL8thnQBODBdLprEHo/iAgKmiwFSF3Qo09GYCKkmTqFcnhjRisWRMfpdfHOOzKjQsiSezye4Phaf5gAoJZEvwChyXLfKQlmrWk2Bg0jlGF2Lh5TLThmLNbNkI+kUocHcliFnFEkwDjGYSYQSki0iTdTmXWjzH1Gnll6gs7JYYZHCHmay+8ZX+uTxACFpEwIMBzmHAPIMds678BiJZDTn2jD0YtVaz4C2zRkPZ4alhouGCyOZgMDLImQUk7uY5V9W/xnauijuHI2Ix9V6hPpsQJEO7N3vIdtBQs6di6UBSCYhcgnMobQihslZneGQhcWYhQ5zmKl+Z8hbrAPtu0bMB/I9VmMETeDCUxgDWhmtqUQchj6lYv6+98QbYC9x7F/o/IDjf+l8jOmDLPMaT1yrOUZEKejzd4QCEx902t84wshPz/kt4RghsGglZbBPyh1+dsD/kdfDgYnFzIhMc5ySwAw0GF8mFsXtnlfQDA5bDKRRSQsKa0ux974Qjb7DQE4BgNEAwOteyrNpae43VfllLLzcn9UYYgFCeqwc0/P6O3eXkgN9Vj3aAKsqMf74O/9wdgbhqXJpcXfp21oVvi5zyNWWl7VKey6uzP2/70AI1cf+5U5P6azJhy+/TOW9QuPozW7mIXpoXgqnRgF+hPgt3+UiH/vP1Op3hZAGMvyK2vuhWT8lhuk8VzYkPN1PqpzSEASiEgzA4xuZe8ZI7WqaHUC1MqKyptiLuuz52RHna1CG19K27A0Q4Fwvq2wTyrZlM2oetO84p5QxbU01P80FwpcHwAmAfZDvkjlTNP4Rz9JONMnwYiUaZgemezrX/2//7jq9hVAR7HasbygUChYkm+Bv+K7lYEfl5tySUhIH2wHjnbApsGGkJR01MirdvbCpf39m7cD5oy89fQNXm/lj0tDG8LarCNWOmlq4dcCDuVnmSWgQwg0KEeZwpBddu7td3u6L2vGPAbaFAH6X2vLY9dpz89qtV6qJtUqOWOa1NmcI1yWGEylnyt/qnUJNzVZ2LHDLlbNBMYE+o8i2d94uPvGjY594dpM+vbhmuh2MWcm5BmzQbObnIDLDFaxvJoAngnkCHAI0Hf5/ddVklGnqtPKrrSFR0nkCqRTyFegGh0FQEiltS4Rcr6rvPw8QptNgLG2vPLLfzdqrKl19FJbSk3RKkLOtgUgoFm829f1JgOidcYMNbbcZ4yRw3wW09ws6NlnN4J5455FCxtKS/1NyOYcGELi4EGeMZT42lC0unxn1u7MGMaGJ3h4e1nWuhhTs0zX90EeMqGeCEPYMl9jKwyVI4LIE137pXRNt6wl71VXp2tse3nU471EVJTDKfEr6fNAlAQkpBTDjpPsGRh47KF9vb++mkjr1tYTFW/HOFBzs3z8QPuCr0+f9iakhHYcjZ4+EgNDhNE0kEghnbOzI6T3WVkrWn5+Jqg/P8ximyTnmYpCyjx+piUAZICUth0jEC51oekUrf1BFoI0LJfZOzi0JeXYT7b1DLy/5N13//RJQHm0kxtjS80E8P1z5oR9LnkqtbauB/DWzMrK754SLLktaFmTRU0UOhaxoRUjnSFXT48R7eiZBlJgJw2xi0i3eYCsBNx6XN0l5DMhr1I+rijTas5MW5oGCa0NkJCd/X2t169Zf8dbhw/3Fl6xPvjsZXeWel03diRTNy56fdV7RYc9orWrWxZIAFhcWXHx/5o5Y23X0i8++/CcObPPfPn1nzy8fdPZu4aG707ncrYwTVNYLkuUBk05a6ZE06lQpAC3DfTmwANmnuQTJloEKAXl8UDMO03IgN+EIY1hrdNth/tbalpXXL+6r68XAH4ya9bc7iXXvDqvvuYBtzQOVcNoZ2YqJvDHFfl/MmtWeOmpU35dW1l+eWIkMbJnaPjn9/1p14MrRg4M/+6COY3nVNR+UxrG+W4gCMNQPJywQ1u2TTbP6DOpLAe1vgo8XJgAjw+etIbyuPTwrOkH06bVy05u/av7Ov/tG5s3Hyjm+xsuvfjmpkjFj2AI2j8wcO9pK17/eSFXOlKjP7Z8QQRwGPCvvOLS+6aFy7/lcrvRNxzfuS858pQWcm93Iq3jyp5UJq2QbRiZUDzuO7ej5zZzbp+PqjJQmyrAXT7AHJ82DLABUJLV6Nra6l/ud7s+rresnnK35ZJSWtlczpxSErw+GiyZ3x2Pv7Hq4MG7r39349Z8PEYYqzY03naNyM8Qqy684PJpFeX3VZeFTocs1PUFAVoDjgMQMTIZ0m+9D0zphGhMQ20PgveWTggeAKA1yOOBvOAswO8f4wz5F4ZG4iP7h4fv/cxLrz8MAG8vWGAsWrPmuHKLMV54ekQyW1tf+1p9/frbZ56yRGsx2dY6k7RtV9rRpW5BpSUuy/BLjtc7zjWlCXcpjDSTxyHWdKL9LjaEoCGt+nd2dDw35HB/1nGSlhBDAbeRnRoqH25tP7Dprra2g4IIT197rVzU2uqcxD7X0Vdhxs79MydF/N6y2QvDFdOrykrr+0Yz9YZGXZlp1JX7vSHxwTZTDXRDnD4M7vJCHygBTDUh59m2YUarkJh5arpnNNWeZT5Y4Q/sGU2lO984eHDzrXPPeAeLF+tlS5bw8hNEuhOCf6a5WS5tbVW/Pe+8BVdMqn4q6PXGII18ocJ28pVRzYMH7dxH1tad1ZGe4TrHK5gU04lMoiXYzDD1B717c2fNOVRtuuaCEITLBQgBKBvdA0Mvndn64tIO5syxPD8Z8MTMaCSy3lnyhXeiodCZB/r7V0Y87j+39fTvefHQga1rO3o+vmtqQ1mksuniUyObbq3amZzu7PVA+BWNW2oqpGSckNqckqGBM6ztyZ75j61o/3D3mr6hxI1TpsQW1EZnOIRrS0sCMzZ2HHrwrFfe+DY3N0tqbVUnDb74wrqLL7z1nMkNj+zvH1g56bkVlxSfv7V48aVTQv5rQl7XVQGrNKp9+5WqfovEyoDgLb582d8s7OQeSYoJsAHRmAV/vp9l8lSgbyHF7SFYmjf1ZJIrt/WPPL96f+f+e+efsarc7z9t9d7dNy9atfZXRfr+RfAMkCTif5o+veyOWU3rQ1533SMf7rqgOmDFG/zBr9b4PM3lPt+p8HqRjo8c3tk3vA4i6Ztz4XsLpVubue0ejTYPyW6LOG0cSYSpPAealwafnmI2CatWVT2Z6m5ad0Vj6YVDo8750WBJDNDY0tlz47q+wVXXTZ/ynt8wgu8c6Lh88VvvrOWWFkHLl+sTqg0WLJB6zRpnQXXll8rLS6fu7Tz846fa23tfuHTRB+Gy8jCyWfSn0zuHhwYfWtfdO3JOrPqWxlDFeTq1Cyz7YTZlhT4lw2JIgvtcQJqAcgWqzAJBAKMECYMWls9bMgR37pvvrVr26O6Bnr1XXDHFF/T++7RI5WP7U5m5T2zbtviGWXM2TA1XPPP3kchsLF/ex8dsIh+filVWMgB4TJHe19P7dOOLf/g/v1o4/6ZwqCzc2Xd408pDHV+e+ftnz4in7fQXpzb+R2O04rz9vc5LIzl+lbwSWkFJDxMmOaCzE6BFcdBpaaBMgxWzcDONZnVqNMsHomW+mx8+//KdHV+8+v43e3o+3HKg62YBnT03Fv7dtzZvb9/U1XVtfDT73pRIZFyn/UtFUDw+e3bp1TOmrrNMs/6VPXvOXbLu/S17r77qZ1NikW/F44mR7UO9P5z/yuoH1txuXTNvCj/ji0tW3ZYQ/Zp0wgRBAD4bVMrQZaRkbFTuGdTrp96vPrfukgWnR0pCd02uKL90V3fvL6avePmODZcv/ocz6+t/sqXj4H1zX1nZcsJ69EQPPrhlnjkveqVa/afVlyyc3PDart7DD03/w2u3L54cqvuvsy/aKpi6frNzz5fv3LJlqyDgiel1TdcEU+94M1Tu1DOLEpswZACDdj7ZA6BHpTJcJJPMvwm8O3R9kbrDX126gcHV33/rtRn/0ZUY7l56zYaAx33app4dNee/trl/Irmc8FTHvOiVipYv58ZI5U2jOVuv7u3+Nwbo/qnzGi3LFWyPj/zizi1btvKCBW7FoMZc8pBdFu/j8xLAZ0e0WJwALU5AzEhCTItDTIvDmDUENA5jtDTd1QIIvnKelwDno4GBp0rcnshXP3PeQgLUnsHENw8lU+/GPJOKuwbjXsaEgWves2lHIn44AOPu2zZs2XMbgE6ff7LfMKjG7dndAghUVtpg4GwaSGyaJdvnZtU02m2AXQIYApAeEwoDpA3GRie7bzmgr4rBZgAdfcMvzKyK/KDcZV7GwHMXrFz5LoCLMF70eBKWL34ivuSlP955zkuv/JSfeUYCQEcmPW0oHs8s/dPq9uWARmurxhIIQHDMoj/D0JADOabOHCidA1wMuAB2MeBmshV4a49vNwB8PNSmuaVFXPvBBwe6E4k19cGSK/mWW0xuaRF8EmV94y8eHGLWWLZMYPt2BoCQaTWZhuxc0ztysChdhT1GHE7znkjOBT1iEo+aQLZgG8EgjwKV2GQGM9lFdakObAWam45YVu0dTP6rMl3fXL17p/fWtrYRPgkx+YvgC5zTxc72jqSeP5hOpgv5ZL7+3JoHsWar5+OGgDcTcMGl3DkWZTZBaEATdMLS6PCLgXZv1yFyDwKHgOVgwnIGgMveeuttABtagEwxuv2rwY/hHQPAFW+//djYikNxj4oBejiW2qFnpOIwUEmjxOSIfH3dUJA1KcAPZA/J0bVrgg4XJ37kC4OkoPRyPhnCnDz4o2fS0iKwYwcVg6XCF9EE8GudwQVGVpaqlMWM/L4OlAAsBS2YDDfD5U/7SuoHQzSIeOHoiirk5FwoxJ80esJfcRVKfboJ8P8uUnXvVJjf8UhhqanDLEMZIsv5pKBtG1CDbsbuEh6wse1DZ/R7Fw/1v1KkI30K0H81+CLw35aW1i8wPb+q8RmLUZ9k+6AX5tm9BL+T314pgjcBJA3Y70TZjGYoMSLtnYfxwFkjPS0CcCaq25/oEv9D4CQA/ZuysprLvZ7nagz3YieYttE4DGFq0j3eQhXz6Ju7vRBMpKYN6EBlRpzp9nxvcyTy5EzAVzxv+TcFXxzg5lAoeJFlPV1mWvOytnZE0DFhMVEoC+7xHJ+MMKB7vKCKDKRfC0Va2KydOS73dY+FI/fTCTbp/r+BX52PVPhL0lwaNVzn2ko7gsjIn3UCqCoNHnYBg678sTdF+UMpg27wsAtUkyxYgIgBqZnVDNO89Y/h8LmFeqn8m4FfiBbNAM02zcUAazCDhAanDSBHoFAGVJKDs7UcHDcBD4OTJpzNZaDyDKhyFMgBnLQgiMlhzT4p3SGIyz4tFuPTM345AIgyw/TlT0+BIAH0u4CUwfDZipoGBLdVCr02CoSywLALMDSoqU9pg4kGLcEDLqBwrkUTdIq57JjQ5G9CGwFAt+dyXRBCAHC0YHYyBuv2EoIgQ1TYwpjfqziWUmwLxdUJZZzTo0WZLYUthfqoVGlbsILWBNICEGGiDz4tJuPT0ya/qm5IZX8akHRepTSngTVgAalOr7PXSr9QNTkzI+JzmowzBvJ2JGA0AySS2JjbEvTUDPlOy9d1BIHI2pfLrbqnL/NiQQzUyWKR/wPSMABxZ260bxbRHy2iQELr4GGlDrSz889n7Rr5np21Xq23eEdC8b59Q9iWc+jtPYfNh776of6n5O7S5ysCjm/EUSU9Sn/Yo9SvfjiavPfZXHzwhAedx7n+G1W4GfQ2sVDSAAAAAElFTkSuQmCC',w:47,h:64},'\ud83e\udd80':{uri:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAtCAYAAAAeA21aAAAWJklEQVR42r2aeZhV1ZX2f3ufc+58ax6hikGgmAVBEI1CoaCACEZTOEQ73YlN9HNI8kU7dqfTRWnyGWM6MZ3BBLWj0dZOVUyiokFFoRyQURAQKeYaqKKGW/Mdzzl7f3/cW1hGbY1K3+e5T/1zz6611l7vu9Z61xF8Dp9qkGuqEKIOF2BBIaHvzGBaiY+5JWEquhJMkAofBlp66D96wvzh8teczRrkGqAG1BuLKcrK5yfZLhcIUBqIuhwKWew50s0bTzTy2tqDdAHoKgxRhwL0Z7VdfNYDaqswVmUc/9Fsxl0+hmsLvCyzPEwKQo6wAAVIQAoSjQH15j7Psotael5QYABaCNTmwqLpM2bGtgbGDvqxM64Z6f8xaOMmbd5pT/KnRw/y0I/20qI1AgHiMwbhMwVAVyNFDerusym/YhTfKvPzj1l+QgA4gE4HxjVQRp/XGjwSTuxt8F17XrzlTxpk5qYFIJYy3nqgIFU7ZnJ0hTsuYguNiUIj0RIEJhIJkSht+7u5e/561gJudTWypgb1vx6ATBq6Gy/k8qnF/LQwxBhsQOEiAI3EQGALzfE80X080HWkU1wzN9m04Z7p5P7zXnqGQ6gG1DcpKP2XosCOwvLkCKZ1KISWmfvVgEIDJoYScLyXJ9bu4v/ce5Q+DeLTZsKnCsDQ7b2xiGtmlPF40Iskho3ATCdm+uS+XksdOJwrQ+3eLZs69fUsa7GX+Lgr4OHCdzr55uKXeWoIQrsu45+Uh51NfynoXRIKP5Ma01fsndotver9NiqNlgIXL2akl9cea2DFN3fT92nhID8N5tHoR87izMll4pfBqYagQjqEhYXOGKvTAQgczdVu1MOfswZa5ixvmXtdLtvH5fN3pSHK4i4mQFVtmiFyffz91Gyem3F5V9nvA/21b0Z8RuJwlsIEPcwtKRAaTJXAyc/lgmVn8BshkFSnoXTaA1BVixICFozhrtxxItf1obCEifme4wBaglU+aIxwBWeYni9N8Fn/le2jEBfn5AB71zbwrABYgwDUgMurXh/ebEc+pb36hpKkQXbca+hMfv912kowVAJnXB6rdn+RL4salK4+zQGoqsIQAv3f53JBaZ5YQUBoAwx6NPToDKdnLHSAwhgF4RSelKQ/JRQKO+oi26J8Z10bMVWNrNuf9q+nnyfjCZLxpEV20huanGXDlAjCzVSRD4JXSIU0QI/28/3VFRSImlOkenoCUNuRPvy8IlZ6cxCYKBTQqd93+wAiTVgE8pOEHZOoKxV+rOZuHpi1jr/oKgxRg15Vh1LVyPkbqG8Z4AdKC8PvSsczcgDGA6Ot9wL7QeslNjrHT/lNFVwJsGnBUPH8/AMg2IQCjIRisrZADd10LHOS/iBbEkqhUG5xQJmRfrav3cUdWiOGNTJa1KBrqzAq6vj+7k4eKA1qk5Bj45WaUhMKDHA/HOEqXW90np8lgKhM2yg+9wDoNAGpm6aTlWVQLlS6FHzcQ9pnu2PzbUMYTu+Bblb/pJlk3aoPhEu/U4fWqzFXvJn4RirlPoHQFj3KxQWKTPB+OBRkOgoiaDDpZzMpkCLdRZ4WCAgBb3SQSmhipDL9akyD8yHIS2eHa+Q4xhkTI9HnD6ql5z/PbiFQVXUfdOUugRJrsQF77tH2Lze57n8xoEwVdW3CArIlH3G3AgX52QRum0JYpxuLT5wB5t/QMGg9H1PUE5UedhHVc+W7SpP6kLTUaKlx8GP1xXTr87363nmXcd7hJXzpQKexXjzobhhOFQI4ZyS+f7vMunbpNGfesXZ98Nkd7o+vjjAj37Kn0S9tPagt8SEwU+nMpD9OdEucwdPaCNWCcRW4D81jwXUVvOwRSK0QwwxTCrQ0MPBAb4zNuweNn85apO+QCf9ccAiEnWTLCbl6dI39O12LQVV6FtjxHXHX7El8ry/iJeDROKQ2vrDOvOO8AvvHRQEqsXEzRGv8FcxcPBgn2s29lz47cv4e0dir9CfvDP+2MpjuScS8hrKVnoMFBlJo4ckMLSbgQUovRo9D94Fu7s99jIvOXqBmvXGocO6MByoSFz9WkTzcHvQKy7kyc6ASAnXrErKml3Ljpn05euHDFalFj05IHYsEF46bZecWP8HSI/08PAgSb6YeaJw0fWZ8UKi8ltxJawP6fA1s4pNXAvm33L4A9WB2wayRAfl1tzFMakuxUE1hVJ9HM+BxuvrElu0d3LGjkfMn1/Et/Rvctg7Ppf+xpUAHPa7n5KBpPbarQEvn/QaOMBgbTxk5928pIYmwmvoto/5olioPMAZEYnwtN9Sf4LLWfrYkQOPFxERhARbCOZql/J1hqzDbrURDJZ98ODL/htsXAKO9nBWUMqClckSvz7R7fa7XEEafq5p/0cbSGhp7hyZFWvHmh1W+JbVQCATaFQjTb3JyGAR1foj4oCtVJG4KU2ptCmTQcmwtOAhK6NXCFGt5Dnjp9UtZUiiNayu07yoctNsREE5bQJiWxlUidNo6wU2ZvwlXtyfQCg3K1FpKhOPgNsWSv6ihsU/Pxhoak8+umZ1Uwun8yswuDI3O9bpcMrGbvAJ9KHOoBIgX0RgSTusVk3qJpgxVOXpQXDyut61nkOMg9JpSXF2NlILU+c/xzMRn3avf3Vj4a3dnqbCbw8o00S5ax121FYApmFojdDVSV//PPn5cBoiNCzAqb0bzS9gxiLXtsPN61HV3hyxrlmtr1wzbxuDI3lSXFTV/dgSP2InNTrTWSCF22t0xY/OVs7tmTsyLKsvSYmJRnC0NshsUbAKtEUKQ/OI9+qVvLWxd/YVR3c6sUSmjO+K8Ne5eWrRGrhGwBvjeAsyaepwX5zMhld0oHOnXRmtAmW1hs13Zzz6Wk/yDaAexn9SwsQytEWsEouZDoGH+T2KHrEEtrMehfvg01teTY5pfn4/4eaGU56hJER0uTpgLNfcWeegQh3lk+2qsNZXpGf7ESfePI3ONr00riXsA1R+TurObTl2NZD/y0G0Yuho7bhkNuJq5I2NgCHwWe3U1cBtWDSQBqEfVncfZs0bxx3y/LkfGtCMdaM/CcFXjfQ2RgXtGkXvJLK6uCHDtoGJgX4QHhOBZQA9l5scGINOnu0Dg1Uu4cnoRS5XG3XmSuos38Oy1kciO50v01y6QoTdCps52k0IZlhamhy9p+N3cB7FFOojmzhG8Go/orX6/nE8KJS0tOiWDGUNOdRFP36Kbl00CUxoCR7O9g2OLfqIVkFzkCU+Ykidy2mWib8EZqZ/nZ1GuBklhYZonQ2YypZ31Pc6fty1n6ZgQ/68wxEyAoIY8H0sPXcl/17dyp6ihceMCzIX1OB/VBwhdjRA1qBcWc/G0PO7O9zPXa6R/GXNw2wd5fssJqq99U+zqLCp/rWBm3/lqVJ8jwUykaP5hI1N+tR86O0lVgXsUvE9+W9RMKJO3q0FtSyGsfYfV4y3Nek/IR6jIw0jHRXuDlI0qEZdY6aleNLXpzdFB9rpKBA81ZVUOxDzZg7aOTyhQRRWlMT2qOCFESxhnT2H0dTv66+DCdjEtwDf8fgxiwsaWluNzMTO2d0fZv6WDr1y6gR3DZTQxrG0/NXa/dRn/OiGX74Y8eIclTBIXDxaiP0HfScXd2/9QevjK0eJR3zkd4cZ+Q7R1e53DXYH6AYes4mBqYOmMnt5+pcs9mtG5FsW4GVR6PoR+35cPpHv/IYkjKelLGMSSBvuaA7ppwOKSbJuclqwj9aHeV+ae3zul0MP5uLh0+HWqMdvsSjqPOtO6Nvo9rC7wcZ4IQDxKz7tdXDr7Od7U/5aGgxiOeWrQB1byg0kl/DM6PekN2Ox+qymQKvXKuWNLoq5laAADA04kqI/tzC9qlubkoza6KGiLcdk2RWGHwqwU+N33nHOGOaQ+ok7LYWEZ/huBSKvKaDTy1YYs3d0UFlON1J6CBZ15uQHKGBT2YFOWtf9EgGNRddfVbe3VQ4+vv5iFZ+Xwf0M+Ko/38pupz3D7kKYphouS1WdSsWY2DTa4vUme60uy7oZ3ebJtf6nv5jH2yzMLOXNKab9bkJeSroE2YpZ8+Z0cTrpwUUUfJeEU5OJSiKALTRdaCSQCIcVnVKB1+itNiCckf96by/y+ICOn9JDKjzvHDuaY2zus4y/EY7c/3tn31J1nUnHrRGY3DzJGmKS2tfLihhYGZpYxWLMzvV/4AAfccz6504Ms7+glGndpvnkH+2rLYFULccB3T3nR2skhef3U7KQeP3aA9sNZel2nTy6eEWFUfhIVkoixAjwg+jUcUJyWj4BXGrIxW0J6glfrt6Qr9gyIjbK484Gl49xgsRRf9Rp6athPvmGk4dYXJ3q0h2/OWsdDw4nwPQjUYohVuE/O54KLRvMjSzEn7nIyy09jez/NSZdtnYodL76dXzXKsL46y8TvU5J3/CmxYlo3vmwNE2WaSCTQpOCk5pRW+Dl9NCBM2HU0xJ7GECFDk50Tt8ef0b+t2M8Zfj+lGREdXFJoZAZMpivhlSZWX7yBB3U1pqjBEcM1/ucu5PIvjKQu24eJi4uV6dkzDtgJUnGHQyd6fKP3NIdD8aRBUTjF4kk9WGOAETKt3HRpaFSfw97pw6EgLNjbHODYgVwu9GpCF7RqfAiiEvrNFINeg6Rl0OchoVVST4y4/rAbwMXp07g7O1hx0Xpe1FUY5sYFmKIO58VKFpxbziMhA4EDJCyDkz7wOOC1bXyOY5n4LT9Ts7ITlOY4vLorn37bwEFgBXT6dmIamk9T6g9XmoQmS0EIAa0h4XR7dSLqEcmU4WlPQJ5tvNQaT22WfeH6HtGfmjXdXZvtY0q2i55XxKPblrNC1LHdXFiP88BMJswZweMhgywEoiPOrld3WA/M6co/1x9wzg16qAgGleVaLsJrI4MOOUGHOUqyIaWJpyR+Moxv8wGB9HRwgOsI4oamwRac2JOjBwwdbdXu0ZhMbn4unnpoY1ffzlMs9zasz2HlWSP5fVGAWQGDkvFhHv3pDJYZ1xUTvHEWjxdnMRMQrQO88vBbrLrpkL3p/kTv0xt1/++/EMv7yx8Tbtu+JMHWASs/FgkY3Sf9HPM4dGlBgdehoMyBsEQkMhL56fI9U0pbIz6O9VkkwykCowa0zBt8O1Tc/9KSydH9145Pjq0aS+HaBg7pauTUTqyVO+gs0zydE2BUlsHUUA6FIS+WOPwl7htXzO3JKDRHefiGOm6ph8SO2VizAbET++aLyP/hZM5q6WL8u62euT0DnvlFeMZ6BjyiGyFKCqNUnt2PHmcgujQcVWCdxgyQsPFgGO/RXM6t6EdM7gUbG4mVVm8hlUId7+XX/76VOx5sI/bKMOZ/dhHL5hZyzYkoL4nXl7F+VD6e1g5+O+8FHgOoXoB5Vz2OBt5cxt9PyuOunADlQ82R7dJnIELySI7R0BTi7fwYV07uxijRkGdAj0oToTh9HPDMvlwmdYSpmB7RlEUVKcBIL2aVAxJMvMimXtbdtpXrn26ktxaMqwTu8FWbmAf+LWnuTunMpubqP+BeORL/D+Zx37gsbpYCsEliYpzaTMl0hzawuYTnkoLzJkcYdbaNLpQIB9inIK4/xfLt4/GfTAme2VXA1JiH8rwUIuwgtEAbGjc7RnZBEpVCaXANP1ZrL3/5l61c8chxkoi0arxpE7KyMtMKCwHq9xisSq+gV5VScN98fjc6lyXEUQg0FgatQdxuH07ABaFJmArZFKQ+bpBb1s8XzhtAjTCRUQWH1UcuMz5TCTThZI+HjfuyddAQIuG6kZNRY6t0zWafFJ0eObircl7f5aPyuB4bFxeFH6spwsOjn+LrWqOGb5JNDUJoEKtwa6swVgk4dAX3js5jCTESGPiSGvVus/jxO/XBXTHDzCVbTOrCKS+XzMrzivKIxyHZ7yHeLPH1OumhRp2mSiCgPWYQinnEhSMSMC0SjMQpPpFia9DgTzPq2MtT/HH/FbRPzud2QJEkWZbD1zYuY5MUPK6qMMi81XLKxKH28JVFLDi3jBc9GqSBJ+YQPdDNrbPX8VuAdSs4Z3qQRe0J5o3R8uxAylcycCRb19uIqRP6mDYihnZAyNODfUx4+UAW4WM5zJ0RgbJoOtgm9CfQHQP855tH+Mbf7SG6ZyXfm5zHXaaLwoNojfLmyCffewfpfZpgZWW6YSzP5kafiUcKrEiC7m3tXD57Hb+970yCjVfy4OIctowK8f05+SwvzFMlwfKYW3JGP1Nsg91tAeJJiTBPTweIAT0xQ3d3+N2KnKRLaSztiAbi2FkSd3wRX5s4mhuFgDOf5u53O7jVNbBxUfkGc391DmfpzAB4KgDVGano/nOZNsLPChQqoel/rZVVC19gg65Gzh/LNaPyuMEjUCQzw6prQNwwKIyJ6dm2ndfjVVubQjA8xJ9f5oNAH2oNiIA2DccURmp/ntT78kj2eDUWFi4SBzUuxK3/kEdYa+SZz/GLg738GInh9WJUjuAqgDW16SNNgDWb0uPw4mKuC/jwa404HOEHX9zEy7oaE1AjfVyPRiNQCU2su9WzXh3LdvtcUZrwcE4Iwz/SD7s7/RzNSrlnlCakthFCfG7k5wwMWObhk36nS8fXNcdkn7/Zs0v2Gg3Hc63mK+a3XzMpnzsNB5HvZfTl07lYCJ7StRgrb+LetYtYWVzANL/kvDOLCRpXEQWEqUFQj/va+eSWBFiMH9F6kj9NX8f9QxPTfWcx+papzNEOwhaYB7v59oz1qYegE8DzldLcOZPD7jKvYH4W8uxdjdm+sFdRmJdSykZK8Zlwr4XARUhz+/FAbM8A37i3rfuh96VGD1gR/r0kzKp8k/GY6MWjmAs8deg1zGciDNzQzi0X+VnvNyjMTWDpzCsNsq4KKUAnfJQpD+M7u3nz1Qg3CYG9dl06TQqDzBHgExa6c5BXZqzjEV2NqRdgarAfbet5486Dke9+qyGycF80Of3AoPPzVxqy4r29XimtNFiUft+rPh/rttIopXExEHgx3zlhbH7iqHnpvW0dD2kwdRVGLRhaI/VqrDtfp7c/zgZMhAYRSZADMOEkTm0VxopN1O84wcp9PdxZ38ep/aG5Kr2qFnsGOdzVxPKj3Rz47m46q6uRq0F/fScsG0mF14PGRu7u4ZcCnLoajFWZSl8FRhWwCpyftvQfBm67tSTnqe7d4e9WjjMXTy6Lp4dyF6V0Bkjv1SCBHqYYCLQUCGmlm62BBP2NffzsH/fZ92yJROK16dHdoW5YtNam63pdLw+W+viqLwvLdt8j+FV1uBqEeIkXh80UeogDNMC3txAHXjslkNag1mS2Kl6DMsLIlhM8vXwDz1aDzDgPoOvArRsmrgJSnOytB169pbfoy1Vxdc2scfGZBozwe4cJJHqY5qffe8sk6uAmEhzsirL+9Q5+dcNmGmSGuYfeSv0rglSZBcuuHctZMzObe3xmRmKdMsSf6b0AwPDdwHB0itoqZFUdaqhLGhJKdl7Gj7IDjN66nxuv20fPJ1k/V4HxlMAdqgYvLmKyXzLnzGKmtMSo0C75UiKlxOe6DGgwDYPOfJODDRG2betg27ff5sSQHQyz6yNaBDE0LO5ezuq4Yte5z7N1SO/8qOf+P3szMKsEIBYrAAAAAElFTkSuQmCC',w:64,h:45}}},1173,[]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,y.jsxs)(r.default,{style:{gap:12},children:[(0,y.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,y.jsx)(j,{}):'take'===t?(0,y.jsx)(f,{}):(0,y.jsx)(v,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]);function j(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[x,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===x?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,y.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,y.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,y.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,y.jsx)(p.Seg,{value:x,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,y.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,y.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,y.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,y.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,y.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,y.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,y.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function f(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[x,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=x[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,y.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,y.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,y.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,y.jsx)(o.T,{size:16,children:e.name}),(0,y.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:x[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(x[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:x[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,y.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,y.jsx)(o.Muted,{children:"\u2014"}):(0,y.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,y.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,y.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,y.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function v(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,y.jsxs)(r.default,{style:{gap:10},children:[(0,y.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,y.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,y.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(r.default,{style:{flex:1},children:[(0,y.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,y.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,y.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,y.jsx)(k,{id:e.id,me:t}):null]},e.id)})]})}function k({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[j,f]=(0,l.useState)(b.lines.map(e=>({...e}))),v=(e,t)=>f(i=>i.map(i=>i.ing===e?{...i,...t}:i)),k='expected'!==b.status,S=(0,l.useMemo)(()=>j.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),$=S.filter(e=>Math.abs(e.pct)>=.5),C=j.reduce((e,t)=>e+t.received*t.price,0);return(0,y.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[S.map(({l:e,i:i,short:l,pct:d})=>(0,y.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,y.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,y.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,y.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>v(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!k?(0,y.jsxs)(o.Row,{children:[(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>v(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,y.jsxs)(o.Row,{gap:4,children:[(0,y.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,y.jsx)(t.TextInput,{editable:!k,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",inputMode:"decimal",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>v(e.ing,{price:100*((0,x.parseMoneyInput)(t)??0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,y.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,y.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round(C))]}),w.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[w.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,$.length?(0,y.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[$.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,k?(0,y.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,y.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,j,i,[w.length?`${w.length} short`:'',$.length?`${$.length} price changes`:''].filter(Boolean).join(', '))})]})}},1174,[812,1000,1152,896,17,385,85,777,876,851,804,1144,1002,840,8]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dayKey",{enumerable:!0,get:function(){return t}}),e.parseDay=function(t){return null},e.KitchenCosts=function(t){return null},e.useKitchenSummary=function(t){return{stockValue:null,lastCount:null,costed:0,below:0,target:70,avgGp:null,prices:0}};const t=(t=new Date)=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1175,[]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=T,_e.periodPay=P,_e.MyHoursPay=k,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),T=(0,a.useOwner)(e=>e.staff),M=(0,i.useMemo)(()=>T.filter(e=>e.active),[T]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,b.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[$,S]=(0,i.useState)(null),[H,I]=(0,i.useState)(''),[W,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>M.map(e=>({...P(e.id,O,v,R,D[e.id]??0,B,z),person:e})),[M,O,R,D,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=M.find(e=>e.id===$),A=Math.round(100*Number(H));return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,x.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,x.jsx)(C,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,x.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>E(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:w(e.person.name)}),c&&e.person.noTax?(0,x.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{S(e.person.id),I(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,x.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]S(null),title:`Hourly rate: ${w(G?.name)}`,children:[(0,x.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,D[G.id],u.gbp)}`:''}),(0,x.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>I((0,f.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate($,A),S(null)}}),$&&null!=D[$]?(0,x.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate($),S(null)}}):null]}),(0,x.jsx)(l.Sheet,{visible:!!W,onClose:()=>E(null),title:`What ${w(M.find(e=>e.id===W)?.name)} sees`,children:W?(0,x.jsx)(k,{staffId:W}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]),x=_r(d[15]);const w=e=>(e??'').replace(' (example)',''),j='Before tax and deductions, estimate';function T(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>P(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function P(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function C({label:e,offset:s,setOffset:t,badge:i}){return(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,x.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e}),i?(0,x.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function k({staffId:e}){const{meId:s,now:f,rid:k}=(0,y.useCtx)(6e4),M=e??s,D=(0,b.useVenuePay)(k).pay,R=(0,a.useOwner)(e=>e.staff).find(e=>e.id===M),z=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[M]??0,O=null!=N[M],[L,$]=(0,i.useState)(0),S=T(M,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...P(M,e,f,z,B,D,v)})),[M,z,B,D,v]);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(l.Banner,{kind:"info",title:j,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,x.jsxs)(l.Muted,{children:[w(R?.name)," \xb7 ",R?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",D.wagePayDay,[1,21,31].includes(D.wagePayDay)?'st':[2,22].includes(D.wagePayDay)?'nd':[3,23].includes(D.wagePayDay)?'rd':'th',", cut-off the ",D.wageCutoffDay,[1,21].includes(D.wageCutoffDay)?'st':[2,22].includes(D.wageCutoffDay)?'nd':[3,23].includes(D.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,x.jsx)(C,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Confirmed paid hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,x.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Gross pay from hours"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{children:"Tips allocated"}),(0,x.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,x.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,x.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,x.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,x.jsxs)(l.Muted,{children:[j,". Tips are shown separately and only once a tip period is approved."]})]}),(0,x.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,x.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,x.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,x.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,x.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,x.jsx)(t.WideTable,{children:(0,x.jsxs)(n.default,{children:[(0,x.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,x.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,x.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,x.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,x.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,x.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,x.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,x.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,x.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,x.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,x.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,x.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,x.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,x.jsxs)(l.Card,{children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:e.label}),(0,x.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,x.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",j.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=C,_e.periodPay=k,_e.MyHoursPay=D,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),x=(0,a.useOwner)(e=>e.staff),P=(0,i.useMemo)(()=>x.filter(e=>e.active),[x]),C=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:v,rid:N}=(0,y.useCtx)(6e4),B=(0,f.useVenuePay)(N).pay,[O,L]=(0,i.useState)(-1),[S,$]=(0,i.useState)(null),[H,W]=(0,i.useState)(''),[E,I]=(0,i.useState)(null),_=(0,i.useMemo)(()=>P.map(e=>({...k(e.id,O,v,R,C[e.id]??0,B,z),person:e})),[P,O,R,C,B,z]),V=_.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),F=_[0]?.label??'',G=P.find(e=>e.id===S),A=Math.round(100*Number(H));return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,w.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,w.jsx)(M,{label:F,offset:O,setOffset:L,badge:0===O?'Current period':void 0}),(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),_.map(e=>(0,w.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>I(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,w.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:j(e.person.name)}),c&&e.person.noTax?(0,w.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),W(null==C[e.person.id]?'':(C[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,w.jsxs)(l.T,{size:13,colour:null==C[e.person.id]?h.colours.muted:'owner'!==e.person.role&&C[e.person.id]$(null),title:`Hourly rate: ${j(G?.name)}`,children:[(0,w.jsx)(l.Muted,{children:G?`${G.level??a.ROLE_LABEL[G.role]} \xb7 ${G.job}${G.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(G,C[G.id],u.gbp)}`:''}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",inputMode:"decimal",value:H,onChangeText:e=>W((0,b.sanitiseMoneyTyping)(e)),style:l.styles.input}),Number.isFinite(A)&&A>0&&A{a.useOwner.getState().setRate(S,A),$(null)}}),S&&null!=C[S]?(0,w.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(S),$(null)}}):null]}),(0,w.jsx)(l.Sheet,{visible:!!E,onClose:()=>I(null),title:`What ${j(P.find(e=>e.id===E)?.name)} sees`,children:E?(0,w.jsx)(D,{staffId:E}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),f=_r(d[13]),b=_r(d[14]),x=_r(d[15]),w=_r(d[16]);const j=e=>(e??'').replace(' (example)',''),T='Before tax and deductions, estimate',P=[];function C(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,f.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>k(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function k(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,f.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),b=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=b&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=b).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function M({label:e,offset:s,setOffset:t,badge:i}){return(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,w.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e}),i?(0,w.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,w.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function D({staffId:e}){const{meId:s,now:b,rid:D,today:R}=(0,y.useCtx)(6e4),z=e??s,v=(0,x.useStaffTips)(D,R).pot,N=(0,f.useVenuePay)(D).pay,B=(0,a.useOwner)(e=>e.staff).find(e=>e.id===z),O=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),L=P,S=(0,y.useHourly)(),$=S[z]??0,H=null!=S[z],[W,E]=(0,i.useState)(0),I=C(z,W),_=(0,r.default)().width<520,V=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...k(z,e,b,O,$,N,L)})),[z,O,$,N,L]);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(l.Banner,{kind:"info",title:T,children:"Gross pay from your clocked hours at your hourly rate. Tax, National Insurance and pension come off in payroll."}),(0,w.jsxs)(l.Muted,{children:[j(B?.name)," \xb7 ",B?.job," \xb7 ",H?`${(0,u.gbp)($)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",N.wagePayDay,[1,21,31].includes(N.wagePayDay)?'st':[2,22].includes(N.wagePayDay)?'nd':[3,23].includes(N.wagePayDay)?'rd':'th',", cut-off the ",N.wageCutoffDay,[1,21].includes(N.wageCutoffDay)?'st':[2,22].includes(N.wageCutoffDay)?'nd':[3,23].includes(N.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,w.jsx)(M,{label:I.label,offset:W,setOffset:E,badge:0===W?'Current period':void 0}),(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Confirmed paid hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(I.paid)})]}),I.pending?(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,w.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(I.pending)})]}):null,(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Gross pay from hours"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{children:"Team tips pot"}),(0,w.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(Math.round(100*v))})]}),(0,w.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,w.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(I.gross)})]}),(0,w.jsxs)(l.Muted,{children:[T,". Tips: the whole team's pot so far, not a personal share."]})]}),(0,w.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),_?(0,w.jsxs)(n.default,{testID:"pay-shifts-list",children:[I.shifts.map(e=>(0,w.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,w.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),I.shifts.length?(0,w.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(I.rate),"/hour."]}):null]}):(0,w.jsx)(t.WideTable,{children:(0,w.jsxs)(n.default,{children:[(0,w.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,w.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),I.shifts.map(e=>(0,w.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,w.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,w.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,w.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,w.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(I.rate)}),(0,w.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),I.shifts.length?null:(0,w.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),I.shifts.some(e=>e.open)?(0,w.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,I.pending?(0,w.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,w.jsx)(p.SectionHead,{title:"History"}),V.map(e=>(0,w.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>E(e.o),children:(0,w.jsxs)(l.Card,{children:[(0,w.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(l.T,{weight:"semibold",children:e.label}),(0,w.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.gross)})]}),(0,w.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours \xb7 ",T.toLowerCase()]})]})},e.o))]})}},1176,[812,1177,17,385,85,409,777,876,851,863,804,1178,1057,1035,840,1179,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NARROW_W",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"useNarrow",{enumerable:!0,get:function(){return f}}),_e.WideTable=function({children:e}){return f()?(0,o.jsx)(l.default,{children:e}):(0,o.jsx)(n.default,{horizontal:!0,children:e})},_e.TRow=function({heads:e,head:n,style:i,children:s}){if(!f())return(0,o.jsx)(u.Row,{gap:0,style:i,children:s});if(n)return null;const h=t.default.Children.toArray(s);return(0,o.jsx)(l.default,{style:[i,{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',rowGap:6,columnGap:8,paddingVertical:8}],children:h.map((n,i)=>{const s=e?.[i],f=t.default.isValidElement(n)?t.default.cloneElement(n,{style:[n.props.style,{width:'100%',minWidth:0,maxWidth:'100%',alignItems:'center',textAlign:'center'}]}):n;return(0,o.jsxs)(l.default,{style:{flexGrow:1,flexBasis:'46%',minWidth:130,maxWidth:'100%',alignItems:'center'},children:[s?(0,o.jsx)(u.T,{size:11,colour:c.colours.muted,center:!0,children:s}):null,f]},i)})})};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),i=e(r(d[3])),u=r(d[4]),c=r(d[5]),o=r(d[6]);const s=600,f=()=>(0,i.default)().width!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1178,[17,385,85,777,804,805,8]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1179,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1180,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1180,[17,777,858,1181,8]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1181,[362]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1182,[812,1033,1177,17,1183,219,385,409,85,1185,1186,1187,777,816,876,851,1034,804,889,1193,1178,1057,1035,1188,856,1189,1194,991,840,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1183,[17,385,85,1184,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1184,[17,780,8]); -__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1185,[]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1186,[17,85,777,812,876,851,1185,804,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1187,[812,1185,17,385,85,777,884,876,1071,863,804,1178,1057,1188,856,1189,1186,1190,1192,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1188,[1033,1049,1064]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1189,[17,85,777,876,1008,1033,1064,1062,1188,804,856,1187,1050,1057,8]); -__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1190,[1034,1191]); -__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1191,[1034,1185]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1192,[17,85,777,812,1033,1034,1190,1097,804,1051,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1193,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1191,1034,1195,1097,804,1182,1057,1051,1185,1190,1035,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return I}}),_e.allocate=B,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:M,role:v,meId:F,me:R}=(0,x.useCtx)(6e4),N=(0,u.useOwner)(e=>e.staff),A=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),E=(0,u.useOwner)(e=>e.shifts),z=(0,u.useOwner)(e=>e.tronc),_=(0,u.useOwner)(e=>e.troncCash),V=(0,u.useOwner)(e=>e.troncHistory),U=(0,u.useOwner)(e=>e.troncLog),q=(0,c.useOrders)(C),H=(0,j.useVenuePay)(C).pay,[W,Y]=(0,i.useState)(-1),[K,G]=(0,i.useState)(''),[Q,J]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[ee,te]=(0,i.useState)(z.text),[se,oe]=(0,i.useState)(null),ie='staff'!==v,ne='owner'===v,{s:re,e:le,key:ae}=(0,j.venueRange)(H,'tips',W,S),de=`${(0,h.niceDate)(re)} \u2013 ${(0,h.niceDate)(le)} ${le.getFullYear()}`,ce=V.find(e=>e.key===ae),ue=e=>u.useOwner.getState().setOwner({tronc:{...z,...e}}),pe=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),he=Math.round((le.getTime()-re.getTime())/864e5)+1,me=(0,i.useMemo)(()=>{let e=q.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(re)&&e.createdAt.slice(0,10)<=(0,h.ymd)(le)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!pe)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ae,q.length,pe]),fe=(0,T.useCashUp)(e=>e.cashUps),ye=Math.round(100*(0,k.cashUpTipsBetween)(fe,C,(0,h.ymd)(re),(0,h.ymd)(le))),ge=_[ae]??0,xe=ce?ce.pot:me+ye+ge,je=(0,i.useMemo)(()=>{const e={};for(let t=0;tM)break;const o=(0,h.ymd)(s);N.forEach(t=>{const s=A.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ae,A.length,E.length,N.length]),be=N.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&z.includeManagers||'owner'===e.role&&z.includeOwner)),we=(0,i.useMemo)(()=>{if(ce)return ce.rows;const e=be.map(e=>{const t=(je[e.id]?.paid??0)/60,s=z.points[I(e)]??1;return'hours'===z.method?t:'points'===z.method?t*s:'equal'===z.method?t>0?1:0:z.custom[e.id]??0}),{amounts:t}=B(xe,e),s=e.reduce((e,t)=>e+t,0);return be.map((o,i)=>({staffId:o.id,hours:(je[o.id]?.paid??0)/60,points:z.points[I(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[ce,be.map(e=>e.id).join(),je,z,xe]),Te=we.reduce((e,t)=>e+t.amount,0),Ce=ce?0:(()=>{const e=we.map(e=>e.pct);return B(xe,e).remainder})(),Se=Object.entries(z.custom).filter(([e])=>be.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ke='custom'===z.method&&Math.abs(Se-100)>.01,Me=new Date(le.getFullYear(),le.getMonth()+2,0),ve=[...V].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==V.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),$e=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(we.map(e=>{const t=N.find(t=>t.id===e.staffId);return`${D(t.name)},${I(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(Te/100).toFixed(2)}`]);return ie?(0,$.jsxs)(l.default,{style:{gap:10},children:[(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,$.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>Y(W-1)}),(0,$.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(d.T,{weight:"semibold",children:de}),ce?(0,$.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${ce.lockedAt}`}):W>=0?(0,$.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,$.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:W>=0,onPress:()=>Y(W+1)})]}),(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Card tips on orders"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.card:me)})]}),(0,$.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cashUps??0:ye)})]})}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:"Other cash tips"}),(0,$.jsx)(d.T,{children:(0,p.gbp)(ce?ce.cash:ge)})]}),ce?null:(0,$.jsxs)(d.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",value:K,onChangeText:e=>G((0,P.sanitiseMoneyTyping)(e)),style:[d.styles.input,{flex:1}]}),(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(K)>=0)||''===K.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{..._,[ae]:Math.round(100*Number(K))}}),G('')}})]}),(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,$.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(xe)})]}),(0,$.jsx)(d.Muted,{children:pe?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ce?(0,$.jsxs)(d.Muted,{children:["Locked with method: ",O[ce.method],"."]}):(0,$.jsxs)(d.Card,{children:[(0,$.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,$.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys(O).map(e=>(0,$.jsx)(d.Chip,{label:O[e],selected:z.method===e,onPress:()=>ne&&ue({method:e})},e))}),ne?null:(0,$.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===z.method?Object.entries(z.points).map(([e,t])=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{children:e}),(0,$.jsx)(d.Row,{gap:6,children:(0,$.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ne&&ue({points:{...z.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===z.method?(0,$.jsxs)($.Fragment,{children:[be.map(e=>(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{style:{flex:1},children:D(e.name)}),(0,$.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(z.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ue({custom:{...z.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ue({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,$.jsxs)(d.T,{size:13,colour:ke?m.colours.red:m.colours.ok,children:["Total ",Se.toFixed(1),"%",ke?' (must be 100%)':' \u2713']})]}):null,(0,$.jsx)(d.Toggle,{label:"Include managers",value:z.includeManagers,onChange:e=>ne&&ue({includeManagers:e})}),(0,$.jsx)(d.Toggle,{label:"Include owner",value:z.includeOwner,onChange:e=>ne&&ue({includeOwner:e})}),z.includeOwner?(0,$.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,$.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.T,{center:!0,weight:"semibold",children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,$.jsxs)(d.T,{center:!0,children:["Points: ",'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013']}),(0,$.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,$.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,$.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(Te)]})]}):(0,$.jsx)(r.default,{horizontal:!0,children:(0,$.jsxs)(l.default,{children:[(0,$.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,$.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),we.map(e=>{const t=N.find(t=>t.id===e.staffId);return(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[D(t?.name),je[e.staffId]?.est&&!ce?'*':'']}),(0,$.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,$.jsx)(d.T,{size:13,style:{width:54},children:'points'===z.method||'points'===ce?.method?e.points.toFixed(1):'\u2013'}),(0,$.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,$.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,$.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,$.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,$.jsx)(d.T,{size:13,weight:"bold",colour:Te===xe?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(Te)})]})]})}),(0,$.jsxs)(d.Muted,{children:[Te===xe?`\u2713 Total equals the pot (${(0,p.gbp)(xe)}).`:'\u2717 Total does not equal the pot.',Ce?` Rounding: ${Ce}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ce?null:(0,$.jsx)(d.Button,{label:"Approve & lock period",disabled:!ne||W>=0||ke||Te!==xe||xe<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${ae}`,key:ae,label:de,end:(0,h.ymd)(le),pot:xe,card:me,cash:ge,cashUps:ye,method:z.method,rows:we,lockedAt:e,by:R};u.useOwner.getState().setOwner({troncHistory:[t,...V],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${R} approved & locked tips for ${de}: ${(0,p.gbp)(xe)} split ${O[z.method].toLowerCase()} between ${we.filter(e=>e.amount>0).length} staff`},...U]})}}),!ce&&W>=0?(0,$.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ne||ce?null:(0,$.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,$.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>J(!0)}),ce?(0,$.jsx)(d.Button,{small:!0,kind:"secondary",label:ce.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ce.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${de} approved: ${(0,p.gbp)(ce.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:V.map(e=>e.id===ce.id?{...e,shared:(0,h.niceDate)(S)}:e)}),oe('Posted to All staff chat.')}}):null]}),se?(0,$.jsx)(d.Banner,{kind:"info",title:se}):null,(0,$.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,$.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(xe)} = allocated ${(0,p.gbp)(Te)}`],[z.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(Me)} ${Me.getFullYear()}`],[!0,'Tip records kept for 3 years',`${V.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${U.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,$.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,$.jsxs)(l.default,{style:{flex:1},children:[(0,$.jsx)(d.T,{size:14,children:t}),(0,$.jsx)(d.Muted,{children:s})]})]},String(t))),(0,$.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{te(z.text),Z(!0)}})]}),(0,$.jsx)(y.SectionHead,{title:"Tip history & audit log"}),V.map(e=>(0,$.jsxs)(d.Card,{children:[(0,$.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(d.T,{weight:"semibold",children:e.label}),(0,$.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,$.jsxs)(d.Muted,{children:[O[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),U.map(e=>(0,$.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),V.length||U.length?null:(0,$.jsx)(d.Muted,{children:"No approved periods yet."}),(0,$.jsxs)(d.Sheet,{visible:Q,onClose:()=>J(!1),title:"Tips summary export",children:[(0,$.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,$.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:$e.map((e,t)=>(0,$.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,$.jsxs)(d.Muted,{children:[de," \xb7 ",O[ce?.method??z.method]]})]}),(0,$.jsxs)(d.Sheet,{visible:X,onClose:()=>Z(!1),title:"Tipping policy",children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ne,value:ee,onChangeText:te,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ne?(0,$.jsx)(d.Button,{label:"Save policy",onPress:()=>{ue({text:ee}),Z(!1)}}):null,(0,$.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,$.jsx)(L,{})},_e.useStaffTips=A,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=A(e,t);(0,i.useEffect)(()=>{if(!o.showToday||R()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=A(e,t),r=`Tip pot this period, ${F(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${F(i)}`;return(0,$.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,$.jsx)(E,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,$.jsx)(E,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=L;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),M=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]);const O={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},I=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',D=e=>(e??'').replace(' (example)','');function B(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const F=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function R(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const N={pot:186.4,today:48.5};function A(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,M.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),R()?{pot:N.pot,today:N.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function E({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${F(s)}`;return(0,$.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,$.jsx)(d.Muted,{center:!0,children:o}):(0,$.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:F(s)})]})}function L(e={}){const t=(0,x.useCtx)(6e4),s=A(t.rid,t.today);return(0,$.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,$.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,$.jsx)(E,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,$.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,$.jsx)(E,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1179,[813,812,822,17,385,278,85,409,777,858,876,851,863,804,1161,1178,1057,1035,1139,899,1008,1032,839,1049,1034,880,840,8]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1180,[843,1054,1072,1089,17,85,831,777,858,1055,862,861,863,804,1051,1078,1181,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1181,[17,777,858,1182,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1182,[362]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,M=(0,f.tipsPeriod)(w,S.start,1),v=(0,f.wagePeriod)(w,D.start,1),B=e=>{l({...a,...e}),x(null)};return(0,$.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,$.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,$.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,$.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,$.jsx)(h.Chip,{label:R[e],selected:a.tipsFrequency===e,onPress:()=>B({tipsFrequency:e})},e))}),(0,$.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,$.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,$.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,$.jsxs)(h.Row,{children:[(0,$.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>B({tipsEndsDaysBefore:e})}),(0,$.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,$.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,$.jsxs)(h.Card,{children:[(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,$.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>B({wagePayDay:e})})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,$.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>B({wageCutoffDay:e})})]}),(0,$.jsxs)(h.Muted,{children:["Period runs the ",z(a.wageCutoffDay)," to the ",z(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,$.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,$.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,$.jsx)(h.Chip,{label:I[e],selected:(a.weekendRule??'none')===e,onPress:()=>B({weekendRule:e})},e))})]}),(0,$.jsx)(T.SectionHead,{title:"Preview"}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(H,{label:"Next tips payday",day:S.payday,period:S}),(0,$.jsx)(H,{label:"Then",day:M.payday,period:M}),(0,$.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,$.jsx)(H,{label:"Next payday",day:D.payday,period:D}),(0,$.jsx)(H,{label:"Then",day:v.payday,period:v})]}),(0,$.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,$.jsx)(h.Banner,{kind:"success",title:y}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=A,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return Y}}),_e.summaryTable=G,_e.detailTable=U,_e.copyText=_,_e.periodOptions=q,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:v}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:v,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:H}=(0,k.useVenuePay)(s),O=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),F=(0,P.useHourly)(),V=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,$.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,$.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,$.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>q(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>A(ye,O,L,r,F),[ye.key,O,L,F,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage(v)?(0,$.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===H?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,$.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,$.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,$.jsx)(J,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,$.jsx)(h.Card,{highlight:b.colours.gold,children:(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,$.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,$.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,$.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,$.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,$.jsx)(M.HoursExport,{}),B?(0,$.jsx)(i.default,{style:{alignItems:'center'},children:(0,$.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,$.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await _(E(G(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,Y(G(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,Y(U(ge))),Te('CSV downloaded (one line per shift).')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=G(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,$.jsx)(h.Banner,{kind:"success",title:he}):null,V?(0,$.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,$.jsx)(u.HoursSummaryCard,{name:N(e.person),role:W(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,$.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${N(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"hours-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:K[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,$.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,$.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${N(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,$.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,$.jsxs)(i.default,{style:{width:K[0]},children:[(0,$.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",N(e.person)]}),(0,$.jsx)(h.Muted,{children:W(e.person)})]}),(0,$.jsx)(h.T,{size:14,style:{width:K[1]},children:e.shifts}),(0,$.jsx)(h.T,{size:14,weight:"semibold",style:{width:K[2]},children:(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:K[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,$.jsx)(h.T,{size:14,style:{width:K[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:K[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,$.jsxs)(h.T,{size:14,weight:"semibold",style:{width:K[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,$.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:K[0]},children:["Total (",ge.length,")"]}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[1]},children:me.s}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:K[2]},children:(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:K[3]},children:(0,l.durText)(me.p)}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,$.jsx)(h.T,{size:14,style:{width:K[5]},children:" "}),(0,$.jsx)(h.T,{size:14,weight:"bold",style:{width:K[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,$.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,$.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,$.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,$.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,$.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,$.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),v=(0,f.tipsPeriod)(u,S.period.start,D),[R,I]=(0,n.useState)(''),[z,H]=(0,n.useState)({}),[O,F]=(0,n.useState)(null),V=(0,n.useMemo)(()=>A(v,p,T,a,{}),[v.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>z[e.id]??G(e),q=V.filter(e=>e.confirmed>0||e.pending>0),J=Math.round(100*((0,B.parseMoneyInput)(R)??NaN)),K=Number.isFinite(J)&&J>0&&J<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(R),Q=q.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:X}=(0,w.allocate)(K?J:0,Q.map(e=>e.confirmed)),Z={};Q.forEach((e,s)=>{Z[e.person.id]=X[s]});const ee=Q.reduce((e,s)=>e+s.confirmed,0),se=Object.values(Z).reduce((e,s)=>e+s,0),te=q.filter(e=>e.pending>0&&!U(e.person)),oe=te.reduce((e,s)=>e+s.pending,0),ne=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...q.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[N(e.person),W(e.person),(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&ee?(e.confirmed/ee*100).toFixed(2):'0.00',s?L(Z[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)(v.start),(0,f.ukDate)(v.end),v.payday?(0,f.ukDate)(v.payday):'',(0,f.decH)(ee),(0,f.hMm)(ee),ee?'100.00':'0.00',L(se)]],re=e=>{F(e),setTimeout(()=>F(null),6e3)};return(0,$.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,$.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,$.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,$.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,$.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,$.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)(v.start,v.end)}),(0,$.jsxs)(h.Muted,{children:[(0,f.ukDate)(v.start)," to ",(0,f.ukDate)(v.end)," \xb7 ",v.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)(v.payday)]}),0===D?(0,$.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,$.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,$.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,$.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,$.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,$.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:R,onChangeText:e=>I((0,B.sanitiseMoneyTyping)(e)),placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",inputMode:"decimal",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),R&&!K?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,$.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),te.length?(0,$.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,$.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,$.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(oe)," not approved yet"]}),(0,$.jsxs)(h.T,{size:14,children:[te.map(e=>`${N(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):q.length?(0,$.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,$.jsx)(o.WideTable,{children:(0,$.jsxs)(i.default,{testID:"tips-table",children:[(0,$.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,$.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),q.map(e=>{const s=U(e.person),t=Z[e.person.id]??0;return(0,$.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,$.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${N(e.person)}`,onPress:()=>H({...z,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,$.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,$.jsxs)(i.default,{style:{width:150},children:[(0,$.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:N(e.person)}),(0,$.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':W(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,$.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,$.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&ee?`${(e.confirmed/ee*100).toFixed(1)}%`:'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,$.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,$.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",Q.length," people)"]}),(0,$.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(ee)," h"]}),(0,$.jsx)(h.T,{size:14,style:{width:64},children:ee?'100%':'\u2013'}),(0,$.jsx)(h.T,{size:15,weight:"bold",colour:K&&se===J?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(se)})]})]})}),q.length?null:(0,$.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),K&&ee?(0,$.jsxs)(h.Muted,{children:["Check: ",Q.length," shares add up to ",(0,x.gbp)(se)," of ",(0,x.gbp)(J)," ",se===J?'\u2713':'',". \xa3",(J/100/(ee/60)).toFixed(4)," per confirmed hour."]}):null,(0,$.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,$.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!K,onPress:async()=>{const e=await _(E(ne()));re(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!K,onPress:()=>{(0,j.downloadText)(`tips-${v.start}-to-${v.end}.csv`,Y(ne())),re('CSV downloaded.')}}),(0,$.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!K,onPress:()=>{const e=ne();(0,j.printTable)(`Tips ${(0,f.rangeText)(v.start,v.end)} (paid ${(0,f.dayMonth)(v.payday)})`,`Total ${(0,x.gbp)(J)} shared by confirmed hours${te.length?` \xb7 WARNING ${(0,f.decH)(oe)} h not signed off`:''}`,e[0],e.slice(1))}})]}),O?(0,$.jsx)(h.Banner,{kind:"success",title:O}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,$.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,$.jsx)(r.CardHeading,{right:'none'===n?(0,$.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next tips payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:["Next payday: ",(0,$.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,$.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,$.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,$.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,$.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,$.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?A(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,$.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,$.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,$.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,$.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,$.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,$.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,$.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),M=_r(_d[26]),v=_r(_d[27]),B=_r(_d[28]),$=_r(_d[29]);const R={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},I={none:'Keep the date',before:'Friday before',after:'Monday after'};const z=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function H({label:e,day:s,period:t}){return(0,$.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,$.jsxs)(h.T,{children:[e,": ",(0,$.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,$.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const O=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function A(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:O(e.in),outT:O(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const W=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,N=e=>e.name.replace(' (example)',''),L=e=>null==e?'':(e/100).toFixed(2),F=e=>e.replace(/[\t\r\n]+/g,' '),V=e=>(0,v.csvCell)(e),E=e=>e.map(e=>e.map(F).join('\t')).join('\n'),Y=e=>e.map(e=>e.map(V).join(',')).join('\r\n');function G(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[N(e.person),W(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[L(e.rate),L(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',L(d.g)]:[]]]}function U(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[N(e.person),W(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function _(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function q(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function J({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,$.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,$.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,$.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,$.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const K=[150,54,100,90,48,62,70]},1183,[812,1033,1177,17,1184,219,385,409,85,1186,1187,1188,777,816,876,851,1034,804,889,1179,1178,1057,1035,1189,856,1190,1194,991,840,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1184,[17,385,85,1185,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'cashup'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"10",width:"18",height:"11",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 14h18M8 10V7h8v3M12 17.5v.2",...n})]}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1185,[17,780,8]); +__d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1186,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(o.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(n.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(n.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(n.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(n.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(n.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(o.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(n.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(n.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(n.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(n.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(n.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(o.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(n.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(n.Muted,{center:!0,children:t}):null,(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(n.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(o.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(n.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(n.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(n.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},Object.defineProperty(_e,"REASON_SHORT",{enumerable:!0,get:function(){return y}}),_e.RemoveShiftSheet=function({a:e,who:s,onClose:o}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(n.Sheet,{visible:!0,onClose:o,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(n.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),p?null:(0,h.jsx)(n.T,{size:15,center:!0,colour:c.colours.amber,testID:"remove-shift-reason-short",children:y}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),o()},style:{minHeight:56}}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Keep it",onPress:o,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});const y='The reason is too short. Type at least 3 letters, for example \u201cForgot to clock out\u201d.'},1187,[17,85,777,812,876,851,1186,804,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},1188,[812,1186,17,385,85,777,884,876,1071,863,804,1178,1057,1189,856,1190,1187,1191,1193,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DELETE_SHIFT_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DELETE_SHIFT_BODY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PAPER_HOURS_FROM",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PAPER_HOURS_FROM_UK",{enumerable:!0,get:function(){return f}}),e.canSeeHoursEdit=function(t){return!!t.isCar||'owner'===t.role||'manager'===t.role},e.deleteBlockedReason=function(a,s,o){if(a.signOff)return"This shift has been signed off and can't be deleted.";const u=(0,n.paidOutFor)(a.date,s,o);return u?.throughDate?`Tips for this day have already been paid (through ${(0,t.slashDay)(u.throughDate)}), so this shift can't be deleted.`:null},e.spansOverlap=d,e.overlappingShifts=function(t,n,a,s,o){return t.filter(t=>t.staffId===n&&!t.voided&&t.in&&t.out&&t.id!==o&&d(t.in,t.out,a,s))},e.overlapWarning=function(n,a){if(!a.length)return null;const s=a.map(n=>`${(0,t.slashDay)(n.date)}, ${l(n.in)} to ${l(n.out)}`);return 1===a.length?`This overlaps ${n}'s existing shift on ${s[0]}.`:`This overlaps ${n}'s existing shifts on ${s.join('; ')}.`},e.pastShiftProblem=function(t){if(!t.staffId)return'Pick a staff member.';if(!t.date||!(0,a.validPastDate)(t.date,t.today))return`Enter a past date as DD/MM/YYYY, for example ${f}.`;if(t.outMins<=t.inMins)return'Finish must be after start.';const n=t.outMins-t.inMins;return n>1200?"A shift can't be longer than 20 hours.":t.breakMins<0?'Break minutes cannot be negative.':t.breakMins>=n?'The break is longer than the shift.':null};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);const s='Delete this shift?',o="This can't be used for pay.",u='2026-10-31',f='31/10/2026';function d(t,n,a,s){return t{if(!t)return'';const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1189,[1033,1049,1064]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeleteShiftSheet=function({a:e,onClose:s,onDeleted:o}){const{rid:c,me:h,meId:p,now:m}=(0,x.useCtx)(3e4),y=(0,d.useCashUp)(e=>e.pot),S=(0,u.deleteBlockedReason)(e,y,c),[j,C]=(0,t.useState)(null);return(0,b.jsx)(n.Sheet,{visible:!0,onClose:s,title:S?"This shift can't be deleted":u.DELETE_SHIFT_TITLE,maxWidth:520,testID:"delete-shift-confirm",children:(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[S?(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-blocked",children:S}):(0,b.jsx)(n.T,{size:16,center:!0,testID:"delete-shift-body",children:u.DELETE_SHIFT_BODY}),j?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:j}):null,(0,b.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:S?(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",testID:"delete-shift-close",onPress:s,style:{minHeight:56,minWidth:120}}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"delete-shift-cancel",onPress:s,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{kind:"danger",label:"Delete",accessibilityLabel:"Delete",testID:"delete-shift-yes",onPress:()=>{const t=l.useOwner.getState().deleteEntry(e.id,h,p,m.toISOString());t&&!1!==t.ok?o():C(t?.message??"This shift can't be deleted.")},style:{minHeight:56,minWidth:120}})]})})]})})},_e.AddPastShiftSheet=function({onClose:e,onSaved:s}){const{today:d,me:C,meId:D,now:I,role:v}=(0,x.useCtx)(3e4),P=(0,u.canSeeHoursEdit)({role:v,isCar:p.IS_CAR}),w=(0,l.useOwner)(e=>e.staff),k=(0,t.useMemo)(()=>w.filter(e=>e.active).slice().sort((e,t)=>j(e.name).localeCompare(j(t.name))),[w]),T=(0,l.useOwner)(e=>e.attendance),_=(0,t.useMemo)(()=>(0,l.liveAttendance)(T),[T]),[E,M]=(0,t.useState)(void 0),[O,R]=(0,t.useState)((0,h.addDays)(d,-1)),[A,L]=(0,t.useState)((0,o.slashDay)((0,h.addDays)(d,-1))),[H,$]=(0,t.useState)(!1),[B,Y]=(0,t.useState)(720),[z,F]=(0,t.useState)(1200),[W,U]=(0,t.useState)(0),[K,N]=(0,t.useState)(''),[q,G]=(0,t.useState)(null),J=k.find(e=>e.id===E),Q=(()=>{const e=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(A);if(!e)return!1;const t=`${e[3]}-${e[2].padStart(2,'0')}-${e[1].padStart(2,'0')}`;return!!(0,c.validPastDate)(t,d)&&t})(),V=Q||O,X=(0,u.pastShiftProblem)({staffId:E,date:'string'==typeof Q?Q:(0,c.validPastDate)(O,d)?O:void 0,today:d,inMins:B,outMins:z,breakMins:W}),Z=(0,m.isoAt)(V,B),ee=(0,m.isoAt)(V,z),te=E&&!X?(0,u.overlappingShifts)(_,E,Z,ee):[],se=J?(0,u.overlapWarning)(j(J.name),te):null,ae=e=>{L(e);const t=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e);if(t){const e=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`;((0,c.validPastDate)(e,d)||/^\d{4}-\d{2}-\d{2}$/.test(e))&&R(e)}},ie=e=>{R(e),L((0,o.slashDay)(e))};return P?(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsxs)(a.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[(0,b.jsxs)(n.Muted,{center:!0,children:["Enter a closed shift from a paper printout, from ",u.PAPER_HOURS_FROM_UK," onwards. It is signed off and counts in the hours and pay."]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Staff member"}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(e=>(0,b.jsx)(n.Chip,{testID:`past-shift-staff-${e.id}`,label:j(e.name),selected:E===e.id,onPress:()=>M(e.id)},e.id))}),(0,b.jsx)(n.Field,{label:"Date (DD/MM/YYYY)",value:A,onChangeText:e=>ae((0,o.slashDate)(e,A)),placeholder:u.PAPER_HOURS_FROM_UK,keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Shift date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"past-shift-date",style:{textAlign:'center'}}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"past-shift-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,o.slashDay)(V)}`,onPress:()=>$(!0),style:{alignSelf:'center'}}),(0,b.jsxs)(a.default,{style:{width:'100%',gap:12},children:[(0,b.jsx)(m.TimeEdit,{label:"Start",mins:B,onChange:Y,testID:"past-shift-start"}),(0,b.jsx)(m.TimeEdit,{label:"Finish",mins:z,onChange:F,testID:"past-shift-finish"})]}),(0,b.jsx)(n.T,{size:13,colour:f.colours.muted,center:!0,children:"Break minutes"}),(0,b.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[S.map(e=>(0,b.jsx)(n.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>U(e)},e)),(0,b.jsx)(n.Stepper,{value:W,min:0,max:240,onChange:U,label:"break minutes"})]}),(0,b.jsx)(n.Field,{label:"Note (optional)",value:K,onChangeText:N,placeholder:"e.g. from the paper hours",maxLength:200,accessibilityLabel:"Optional note",testID:"past-shift-note",style:{textAlign:'center'}}),se?(0,b.jsxs)(n.Banner,{kind:"warn",title:"This overlaps another shift",children:[se," You can still save if the paper hours are right."]}):null,X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:X}):null,q&&q!==X?(0,b.jsx)(n.T,{size:15,colour:f.colours.red,center:!0,children:q}):null,(0,b.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,b.jsx)(n.Button,{kind:"secondary",label:"Cancel",accessibilityLabel:"Cancel",testID:"past-shift-cancel",onPress:e,style:{minHeight:56,minWidth:120}}),(0,b.jsx)(n.Button,{label:"Save past shift",accessibilityLabel:"Save past shift",testID:"past-shift-save",disabled:!!X,onPress:()=>{if(!P)return void G('Ask a manager or owner.');if(X||!E||!Q)return void G(X??`Enter a past date as DD/MM/YYYY, for example ${u.PAPER_HOURS_FROM_UK}.`);if(!l.useOwner.getState().addPastShift({staffId:E,date:Q,in:Z,out:ee,breakMins:W,note:K.trim()||void 0,by:C,byId:D,now:I.toISOString()}))return void G("Couldn\u2019t save. Check the times and the date.");s()},style:{minHeight:56,minWidth:160}})]})]}),(0,b.jsx)(y.LookBackCalendar,{visible:H,today:d,selected:(0,c.validPastDate)(V,d)?V:(0,h.addDays)(d,-1),onClose:()=>$(!1),onPick:e=>{ie(e),$(!1)},purpose:"Add past shift",idPrefix:"past-shift"})]}):(0,b.jsxs)(n.Sheet,{visible:!0,onClose:e,title:"Add past shift",maxWidth:520,testID:"add-past-shift",children:[(0,b.jsx)(n.T,{size:16,center:!0,children:"Only a manager, an owner, or the Car can add a past shift."}),(0,b.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close",onPress:e})]})},_e.useCanSeeHoursEdit=function(){const{role:e}=(0,x.useCtx)(3e4);return(0,t.useMemo)(()=>(0,u.canSeeHoursEdit)({role:e,isCar:p.IS_CAR}),[e])};var e,t=r(_d[0]),s=r(_d[1]),a=(e=s)&&e.__esModule?e:{default:e},n=r(_d[2]),l=r(_d[3]),d=r(_d[4]),o=r(_d[5]),c=r(_d[6]),h=r(_d[7]),u=r(_d[8]),f=r(_d[9]),p=r(_d[10]),m=r(_d[11]),y=r(_d[12]),x=r(_d[13]),b=r(_d[14]);const S=[0,15,20,30,45,60],j=e=>(e??'').replace(' (example)','')},1190,[17,85,777,876,1008,1033,1064,1062,1189,804,856,1188,1050,1057,8]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"longDay",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chipDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"weekHolding",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"weekDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"pastWeekDays",{enumerable:!0,get:function(){return d}}),e.stepWeek=function(n,u,o){const s=(0,t.plusDays)(n,7*u);return s>o?o:s},Object.defineProperty(e,"canNextWeek",{enumerable:!0,get:function(){return f}}),e.pickDay=function(t,u){if(!t.trim())return{day:null,problem:null};const o=(0,n.parseDmy)(t);return o?o>u?{day:null,problem:'That date is in the future. Pick today or an earlier day.'}:{day:o,problem:null}:{day:null,problem:t.replace(/\D/g,'').length>=8?'That date does not exist. Use DD/MM/YYYY, for example 04/11/2026.':null}},e.rangeSpeech=function(t,u){const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Showing ${c(t)}${t===u?', today':''}. Week ${c(o.start)} to ${c(s)}.`},Object.defineProperty(e,"weekTitle",{enumerable:!0,get:function(){return p}}),e.setHoursPreset=function(t,n){b={start:t,end:n,from:'rota'}},e.takeHoursPreset=function(){const t=b;return b=null,t},Object.defineProperty(e,"timeSheetLabel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"presetNote",{enumerable:!0,get:function(){return k}});var t=r(_d[0]),n=r(_d[1]);const u=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],o=['January','February','March','April','May','June','July','August','September','October','November','December'],s=t=>{const[n,u,o]=t.split('-').map(Number);return new Date(n,u-1,o,12)},c=t=>{const n=s(t);return`${u[n.getDay()]} ${n.getDate()} ${o[n.getMonth()]} ${n.getFullYear()}`},l=t=>{const n=s(t);return`${u[n.getDay()].slice(0,3)} ${n.getDate()} ${o[n.getMonth()].slice(0,3)}`},i=t=>(0,n.weekOf)(t),y=u=>{const o=(0,n.weekOf)(u);return Array.from({length:7},(n,u)=>(0,t.plusDays)(o.start,u))},d=(t,n)=>y(t).filter(t=>t<=n);const f=(t,u)=>(0,n.weekOf)(t).start<(0,n.weekOf)(u).start;const p=(t,u)=>{const o=(0,n.weekOf)(t),s=o.end>u?u:o.end;return`Week ${l(o.start)} to ${l(s)}`};let b=null;const m=(t,n)=>`Time sheet: export hours as text or a spreadsheet for the rota week ${c(t)} to ${c(n)}`,k=(n,u)=>`Set to the rota week ${(0,t.ukDate)(n)} to ${(0,t.ukDate)(u)}. You can change the dates.`},1191,[1034,1192]); +__d(function(_g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return u}}),e.weekOf=function(s,n=0){const o=(i(s).getDay()+6)%7,u=(0,t.plusDays)(s,7*n-o);return{start:u,end:(0,t.plusDays)(u,6)}},e.parseDmy=function(t){const s=t.trim().match(/^(\d{1,2})\D+(\d{1,2})\D+(\d{4})$/)??t.trim().match(/^(\d{2})(\d{2})(\d{4})$/);if(!s)return null;const n=Number(s[1]),o=Number(s[2]),i=Number(s[3]),d=new Date(i,o-1,n);return d.getFullYear()===i&&d.getMonth()===o-1&&d.getDate()===n&&i>=2020&&i<=2100?u(d):null},Object.defineProperty(e,"MAX_DAYS",{enumerable:!0,get:function(){return d}}),e.rangeProblem=function(s,n){return s?n?nt.shifts),y=h($,g),D=[`${n}: staff hours ${o[i(u).getDay()]} ${(0,t.ukDate)(u)} to ${o[i(d).getDay()]} ${(0,t.ukDate)(d)}`,''];let b=0,P=0;for(const n of p){if(!n.shifts.length)continue;D.push(`${n.name}${n.role?` (${n.role})`:''}`);let o=0;for(const i of n.shifts){const n=m(i)?`paid ${(0,s.durText)(i.paid)} (${(0,t.decH)(i.paid)} hours)`:'still on shift, not counted yet';D.push(` ${c(i.date)}: in ${i.inT||'not clocked'}, out ${i.outT||'not yet'}, ${l(i.brk)}, ${n}${'Pending'===i.status?', waiting for sign-off':''}${y.has(i.id)?', POSSIBLE DUPLICATE: overlaps another shift':''}`),m(i)&&(o+=i.paid,P++)}b+=o,D.push(` Total for ${n.name}: ${(0,s.durText)(o)} (${(0,t.decH)(o)} hours, ${f(o)}), ${n.shifts.filter(m).length} ${1===n.shifts.filter(m).length?'shift':'shifts'}`,'')}P||$.length||D.push('No shifts in these dates.','');D.push(`Grand total: ${(0,s.durText)(b)} (${(0,t.decH)(b)} hours), ${P} ${1===P?'shift':'shifts'}`),y.size&&D.push(`${y.size} shifts overlap another shift for the same person: check them before paying.`);return D.push('Removed shifts are not included. Pending shifts are waiting for sign-off.'),D.join('\n')},e.hoursSheets=function(s,o,u,d,f=new Date){const l=h(d.flatMap(t=>t.shifts),f),c=['Person','Role','Date','Day','In','Out','Break (minutes)','Paid hours (decimal)','Paid hours (h:mm)','Status','Check'],p=[c],g=[c.map(()=>1)];for(const s of d)for(const o of s.shifts){const u=l.has(o.id),d=m(o);p.push([s.name,s.role,(0,t.ukDate)(o.date),n[i(o.date).getDay()],o.inT,o.outT||'',d?o.brk:'',d?Number((0,t.decH)(o.paid)):'',d?(0,t.hMm)(o.paid):'',o.status,u?'Possible duplicate':'']),g.push(u?c.map(()=>2):c.map(()=>{}))}const $=['Person','Role','Shifts','Paid hours (decimal)','Paid hours (h:mm)','Pending hours (decimal)','Possible duplicates'],y=[[`${s}: staff hours ${(0,t.ukDate)(o)} to ${(0,t.ukDate)(u)}`],$],D=[[3],$.map(()=>1)];let b=0,P=0,T=0,w=0;for(const s of d){if(!s.shifts.length)continue;const n=s.shifts.filter(m),o=n.reduce((t,s)=>t+s.paid,0),i=n.filter(t=>'Pending'===t.status).reduce((t,s)=>t+s.paid,0),u=s.shifts.filter(t=>l.has(t.id)).length;y.push([s.name,s.role,n.length,Number((0,t.decH)(o)),(0,t.hMm)(o),Number((0,t.decH)(i)),u||'']),D.push(u?$.map(()=>2):$.map(()=>{})),b+=o,P+=i,T+=n.length,w+=u}return y.push(['Grand total','',T,Number((0,t.decH)(b)),(0,t.hMm)(b),Number((0,t.decH)(P)),w||'']),D.push($.map(()=>3)),y.push([]),y.push(['Removed shifts are not included. Paid hours include pending shifts (waiting for sign-off), shown separately.']),[{name:'Shifts',rows:p,styles:g,widths:[18,22,12,6,8,8,14,18,16,12,18]},{name:'Totals',rows:y,styles:D,widths:[22,22,8,18,16,20,18]}]};var t=r(_d[0]),s=r(_d[1]);const n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],o=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],i=t=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o)},u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;const d=366;function h(t,s=new Date){const n=new Set,o=t=>t?new Date(t).getTime():NaN,i=new Map;for(const s of t){if(!s.inIso)continue;const t=s.name;i.set(t,[...i.get(t)??[],s])}for(const t of i.values()){const i=t.map(t=>({id:t.id,a:o(t.inIso),b:t.outIso?o(t.outIso):s.getTime()})).filter(t=>Number.isFinite(t.a)).sort((t,s)=>t.a-s.a);for(let t=0;t`${Math.floor(t/60)} hours ${String(Math.round(t)%60).padStart(2,'0')} minutes`,l=t=>t?`${t} minute break`:'no break',c=s=>`${n[i(s).getDay()]} ${(0,t.ukDate)(s)}`,m=t=>'On now'!==t.status},1192,[1034,1186]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HoursDayPicker=function({date:e,today:l,onDate:x,testID:p,resetLabel:k,onReset:D,custom:j}){const[f,w]=(0,t.useState)(''),[C,I]=(0,t.useState)(!1),[v,P]=(0,t.useState)(null),W=e=>{P(null),x(e),(0,u.announce)((0,c.rangeSpeech)(e,l))},L=(0,c.canNextWeek)(e,l);return(0,y.jsxs)(s.default,{testID:p,style:{alignSelf:'center',width:'100%',maxWidth:560,gap:8,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.border,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,y.jsx)(n.T,{weight:"bold",size:17,center:!0,accessibilityRole:"header",children:"Pick a day"}),(0,y.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-prev`,label:"\u2039 Previous week",accessibilityLabel:"Previous week",onPress:()=>W((0,c.stepWeek)(e,-1,l)),style:{minHeight:48,minWidth:140}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-next`,label:"Next week \u203a",accessibilityLabel:L?'Next week':'Next week, not available: this is the current week',disabled:!L,onPress:()=>W((0,c.stepWeek)(e,1,l)),style:{minHeight:48,minWidth:140}})]}),(0,y.jsx)(n.T,{size:15,weight:"semibold",center:!0,children:"Go to date (DD/MM/YYYY)"}),(0,y.jsx)(o.TextInput,{testID:`${p}-date`,accessibilityLabel:"Go to date, day month year",value:f,onChangeText:e=>{const t=(0,r.slashDate)(e,f);w(t);const s=(0,c.pickDay)(t,l);P(s.problem),s.problem&&(0,u.announce)(s.problem),s.day&&W(s.day)},placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,width:'100%',maxWidth:200,borderWidth:1,borderColor:v?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,y.jsx)(n.Button,{small:!0,kind:"secondary",testID:`${p}-cal`,label:C?'Close calendar':'Calendar',accessibilityLabel:(C?'Close':'Open')+" the calendar to pick a day",onPress:()=>I(!0),style:{minHeight:44,minWidth:160,alignSelf:'center'}}),(0,y.jsx)(b.AppDateCalendar,{visible:C,today:l,day:e,idPrefix:`${p}-calendar`,back:3650,ahead:0,onClose:()=>I(!1),onDay:e=>{const t=e??l;if(I(!1),t>l){const e='That date is in the future. Pick today or an earlier day.';return P(e),void(0,u.announce)(e)}w((0,d.ukDate)(t)),W(t)}}),v?(0,y.jsx)(s.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(n.T,{testID:`${p}-problem`,size:15,center:!0,colour:h.colours.red,children:v})}):null,(0,y.jsx)(s.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:`${p}-range`,style:{alignItems:'center'},children:(0,y.jsx)(n.T,{size:15,center:!0,colour:h.colours.goldLight,children:(0,c.rangeSpeech)(e,l)})}),j?(0,y.jsx)(n.Button,{small:!0,kind:"ghost",testID:`${p}-reset`,label:k,onPress:()=>{w(''),P(null),D(),(0,u.announce)(k)},style:{minHeight:44}}):null]})};var e,t=_r(_d[0]),l=_r(_d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),c=_r(_d[6]),u=_r(_d[7]),h=_r(_d[8]),b=_r(_d[9]),y=_r(_d[10])},1193,[17,85,777,812,1033,1034,1191,1097,804,1051,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MonthCalendar=function({value:e,onPick:t,testID:n,label:a}){const d=e??(0,i.ymd)(new Date),[c,u]=(0,s.useState)({y:Number(d.slice(0,4)),m:Number(d.slice(5,7))-1}),x=(new Date(c.y,c.m,1).getDay()+6)%7,y=new Date(c.y,c.m+1,0).getDate(),b=[...Array(x).fill(null),...Array.from({length:y},(e,t)=>t+1)];for(;b.length%7;)b.push(null);const f=e=>u(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}});return(0,j.jsxs)(r.default,{testID:n,style:{alignSelf:'center',width:'100%',maxWidth:360,borderWidth:1,borderColor:h.colours.border,borderRadius:14,padding:8,gap:4,backgroundColor:h.colours.surface2},children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",onPress:()=>f(-1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u2039"})}),(0,j.jsx)(o.T,{weight:"semibold",center:!0,children:`${w[c.m]} ${c.y}`}),(0,j.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Next month",onPress:()=>f(1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(o.T,{size:22,colour:h.colours.gold,children:"\u203a"})})]}),(0,j.jsx)(r.default,{style:{flexDirection:'row'},children:$.map(e=>(0,j.jsx)(o.T,{size:12,colour:h.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:b.length/7},(s,d)=>(0,j.jsx)(r.default,{style:{flexDirection:'row',gap:2},children:b.slice(7*d,7*d+7).map((s,d)=>{if(!s)return(0,j.jsx)(r.default,{style:{flex:1,height:40}},d);const u=(0,i.ymd)(new Date(c.y,c.m,s)),x=u===e;return(0,j.jsx)(l.default,{testID:`${n}-${u}`,accessibilityRole:"button",accessibilityLabel:`${a} ${s} ${w[c.m]} ${c.y}`,accessibilityState:{selected:x},onPress:()=>t(u),style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:x?h.colours.gold:'transparent'},children:(0,j.jsx)(o.T,{size:15,weight:x?'bold':'regular',colour:x?h.colours.onGold:h.colours.text,children:s})},d)})},d))]})},_e.HoursExport=function(){const{role:e}=(0,y.useCtx)(6e4);return a.CAN.manage(e)?(0,j.jsx)(C,{}):null};var t=_r(_d[0]),s=_r(_d[1]),l=e(_r(_d[2])),r=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),p=_r(_d[17]),j=_r(_d[18]);const D=e=>(0,d.ukDate)(e),w=['January','February','March','April','May','June','July','August','September','October','November','December'],$=['Mo','Tu','We','Th','Fr','Sa','Su'];function T({label:e,text:l,setText:a,testID:c}){const[x,f]=(0,s.useState)(!1),m=(0,i.parseDmy)(l),{today:p}=(0,y.useCtx)(6e4);return(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center',flexBasis:150,flexGrow:1,minWidth:0},children:[(0,j.jsxs)(o.T,{size:15,weight:"semibold",center:!0,children:[e," (DD/MM/YYYY)"]}),(0,j.jsx)(n.TextInput,{testID:c,accessibilityLabel:`${e} date, day month year`,value:l,onChangeText:e=>a((0,t.slashDate)(e,l)),placeholder:"DD/MM/YYYY",placeholderTextColor:"#7D776C",keyboardType:"number-pad",maxLength:10,style:{minHeight:48,minWidth:0,width:'100%',maxWidth:200,borderWidth:1,borderColor:l&&!m?h.colours.red:h.colours.border,borderRadius:12,color:h.colours.text,fontSize:18,textAlign:'center',paddingHorizontal:8}}),(0,j.jsx)(o.Button,{small:!0,kind:"secondary",testID:`${c}-cal`,label:x?'Close calendar':'Calendar',accessibilityLabel:`${x?'Close':'Open'} the calendar for the ${e} date`,onPress:()=>f(!0)}),(0,j.jsx)(b.AppDateCalendar,{visible:x,today:p,day:m??p,idPrefix:`${c}-calendar`,back:3650,ahead:0,onClose:()=>f(!1),onDay:t=>{const s=t??p;a(D(s)),f(!1),(0,u.announce)(`${e} ${(0,d.ukDate)(s)}`)}})]})}function C(){const{rid:e,today:t,now:l,r:n}=(0,y.useCtx)(6e4),{pay:b}=(0,p.useVenuePay)(e),w=(0,a.useOwner)(e=>e.staff),$=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),C=(0,y.useHourly)(),k=(0,i.weekOf)(t),[I]=(0,s.useState)(()=>(0,m.takeHoursPreset)()),[L,P]=(0,s.useState)(D(I?.start??k.start)),[R,M]=(0,s.useState)(D(I?.end??k.end));(0,s.useEffect)(()=>{if(!I)return;(0,u.announce)((0,m.presetNote)(I.start,I.end));const e=setTimeout(()=>{try{globalThis.document?.querySelector?.('[data-testid="hours-export"]')?.scrollIntoView?.({block:'start'})}catch{}},300);return()=>clearTimeout(e)},[I]);const[S,v]=(0,s.useState)(null),z=(0,i.parseDmy)(L),E=(0,i.parseDmy)(R),W=(0,i.rangeProblem)(z,E),O=(0,d.wagePeriod)(b,t),A=[{id:'this',label:'This week',...k},{id:'last',label:'Last week',...(0,i.weekOf)(t,-1)},{id:'pay',label:'This pay period',start:O.start,end:O.end}],H=(0,s.useMemo)(()=>{if(W||!z||!E)return[];const e=e=>e.name.replace(' (example)',''),t=e=>`${a.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`;return(0,x.hoursIn)({start:z,end:E},w,$,l,C).filter(e=>e.days.length).map(s=>({name:e(s.person),role:t(s.person),shifts:s.days.map(l=>({id:l.a.id,name:e(s.person),role:t(s.person),date:l.date,inIso:l.a.in,outIso:l.a.out,inT:l.inT,outT:l.outT,brk:l.brk,paid:l.paid,status:l.status}))}))},[z,E,W,w,$,C,Math.floor(l.getTime()/6e4)]),Y=H.flatMap(e=>e.shifts),_=(0,i.overlapIds)(Y,l).size,N=Y.filter(e=>'On now'!==e.status).reduce((e,t)=>e+t.paid,0),B=(e,t=!1)=>{v({t:e,bad:t}),(0,u.announce)(e)};return(0,j.jsxs)(r.default,{testID:"hours-export",style:{alignSelf:'center',width:'100%',maxWidth:560,gap:10,padding:12,borderRadius:16,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.surface,alignItems:'center'},children:[(0,j.jsx)(o.T,{weight:"bold",size:18,center:!0,accessibilityRole:"header",children:"Export hours"}),(0,j.jsx)(o.Muted,{center:!0,children:"Pick the dates, then copy the hours as text or download an Excel file."}),I?(0,j.jsx)(r.default,{accessible:!0,accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-from-rota",size:15,center:!0,colour:h.colours.goldLight,children:(0,m.presetNote)(I.start,I.end)})}):null,(0,j.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,j.jsx)(o.Chip,{testID:`hx-preset-${e.id}`,label:e.label,selected:z===e.start&&E===e.end,onPress:()=>{P(D(e.start)),M(D(e.end)),v(null),(0,u.announce)(`${e.label}: ${(0,d.ukDate)(e.start)} to ${(0,d.ukDate)(e.end)}`)}},e.id))}),(0,j.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center',alignSelf:'stretch'},children:[(0,j.jsx)(T,{label:"From",text:L,setText:e=>{P(e),v(null)},testID:"hx-from"}),(0,j.jsx)(T,{label:"To",text:R,setText:e=>{M(e),v(null)},testID:"hx-to"})]}),W?(0,j.jsx)(o.T,{testID:"hx-problem",size:15,center:!0,colour:h.colours.red,children:W}):(0,j.jsxs)(r.default,{accessible:!0,testID:"hx-summary",style:{alignItems:'center',gap:2},children:[(0,j.jsx)(o.T,{size:16,center:!0,weight:"semibold",children:`${H.length} ${1===H.length?'person':'people'} \xb7 ${Y.length} ${1===Y.length?'shift':'shifts'} \xb7 ${(0,f.durText)(N)} paid (${(0,d.decH)(N)} hours)`}),_?(0,j.jsx)(o.T,{testID:"hx-dups",size:15,center:!0,weight:"semibold",colour:h.colours.red,children:`${_} shifts overlap another shift for the same person: marked Possible duplicate. Check them before paying.`}):null]}),(0,j.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(o.Button,{testID:"hx-copy",label:"Copy as text",accessibilityLabel:"Copy the hours as text",disabled:!!W,onPress:async()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);const e=await(0,x.copyText)((0,i.hoursText)(n.name,z,E,H,l));B(e?`Copied hours for ${H.length} ${1===H.length?'person':'people'}, ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}. Paste it into a message, email or document.`:'Copy is not available here. Use Download Excel.',!e)},style:{minHeight:48,minWidth:150}}),(0,j.jsx)(o.Button,{testID:"hx-excel",kind:"secondary",label:"Download Excel",accessibilityLabel:"Download the hours as an Excel file",disabled:!!W,onPress:()=>{if(W||!z||!E)return B(W??'Pick the dates first.',!0);try{const e=(0,c.buildXlsx)((0,i.hoursSheets)(n.name,z,E,H,l));if('undefined'==typeof document)return B('Download is not available here.',!0);const t=new Blob([e],{type:c.XLSX_MIME}),s=document.createElement('a');s.href=URL.createObjectURL(t),s.download=`staff-hours-${z}-to-${E}.xlsx`,document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(s.href),s.remove()},1500),B(`Excel file downloaded: ${Y.length} ${1===Y.length?'shift':'shifts'}, ${(0,d.ukDate)(z)} to ${(0,d.ukDate)(E)}.`)}catch{B('The Excel file could not be made. Try Copy as text.',!0)}},style:{minHeight:48,minWidth:150}})]}),S?(0,j.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,j.jsx)(o.T,{testID:"hx-msg",size:15,center:!0,colour:S.bad?h.colours.red:h.colours.goldLight,children:S.t})}):null,(0,j.jsx)(o.Muted,{center:!0,size:13,children:"Removed shifts are not included. Shifts waiting for sign-off are included and marked Pending."})]})}},1194,[1033,17,385,85,777,812,876,1192,1034,1195,1097,804,1183,1057,1051,1186,1191,1035,8]); __d(function(g,_r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.crc32=n,e.xlsxParts=m,e.zipStored=p,e.buildXlsx=function(t){return p(m(t).map(([t,n])=>[t,o(n)]))},Object.defineProperty(e,"XLSX_MIME",{enumerable:!0,get:function(){return c}});const t=(()=>{const t=new Uint32Array(256);for(let n=0;n<256;n++){let o=n;for(let t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;t[n]=o>>>0}return t})();function n(n){let o=4294967295;for(let l=0;l>>8;return(4294967295^o)>>>0}const o=t=>(new TextEncoder).encode(t),l=t=>t.replace(/[&<>"]/g,t=>({'&':'&','<':'<','>':'>','"':'"'}[t])).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,''),s=t=>{let n='';for(t+=1;t>0;){const o=(t-1)%26;n=String.fromCharCode(65+o)+n,t=Math.floor((t-1)/26)}return n},r=t=>(t.replace(/[\\/?*[\]:]/g,' ').trim()||'Sheet').slice(0,31);const i="";function m(t){const n=t.length;return[['[Content_Types].xml',`${t.map((t,n)=>``).join('')}`],['_rels/.rels',""],['xl/workbook.xml',`${t.map((t,n)=>``).join('')}`],['xl/_rels/workbook.xml.rels',`${t.map((t,n)=>``).join('')}`],['xl/styles.xml',i],...t.map((t,n)=>{return[`xl/worksheets/sheet${n+1}.xml`,(o=t,`${o.widths?.length?`${o.widths.map((t,n)=>``).join('')}`:''}${o.rows.map((t,n)=>`${t.map((t,r)=>{if(null==t||''===t)return'';const i=`${s(r)}${n+1}`,m=o.styles?.[n]?.[r],p=m?` s="${m}"`:'';return'number'==typeof t&&Number.isFinite(t)?`${t}`:`${l(String(t))}`}).join('')}`).join('')}`)];var o})]}function p(t){const l=[],s=[];let r=0;const i=t=>[255&t,t>>>8&255],m=t=>[255&t,t>>>8&255,t>>>16&255,t>>>24&255];for(const[p,c]of t){const t=o(p),f=n(c),h=new Uint8Array([...m(67324752),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0)]);l.push(h,t,c),s.push(new Uint8Array([...m(33639248),...i(20),...i(20),...i(2048),...i(0),...i(0),...i(33),...m(f),...m(c.length),...m(c.length),...i(t.length),...i(0),...i(0),...i(0),...i(0),...m(0),...m(r)]),t),r+=h.length+t.length+c.length}const p=s.reduce((t,n)=>t+n.length,0),c=new Uint8Array([...m(101010256),...i(0),...i(0),...i(t.length),...i(t.length),...m(p),...m(r),...i(0)]),f=[...l,...s,c],h=new Uint8Array(f.reduce((t,n)=>t+n.length,0));let x=0;for(const t of f)h.set(t,x),x+=t.length;return h}const c='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},1195,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1187,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1190,1192,1051,1060,1168,1167,856,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ne,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return oe}}),_e.rotaGrid=le,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:a}=(0,O.useCtx)(6e4),l=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,s.useOwner)(e=>e.shifts),d=(0,O.useHourly)(),c=(0,s.useOwner)(e=>e.availability),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[j,S]=(0,r.useState)(0),P=(0,_.useDateCalendar)(),[B,R]=(0,r.useState)(null),[A,z]=(0,r.useState)(null),[L,N]=(0,r.useState)(null),[Y,E]=(0,r.useState)('week'),[q,J]=(0,r.useState)(!1),Z=(0,O.useSignedIn)()?.name??'',de='staff'!==n,ce=(0,D.addMins)(se(t),7*j*1440);ce.setHours(0,0,0,0);const ue=ne(ce),he=ue.sales,fe='none'===ue.mode,me=(0,W.weekSalesCardCopy)(ue),ge=Array.from({length:7},(e,t)=>{const s=new Date(ce);return s.setDate(ce.getDate()+t),(0,D.ymd)(s)}),pe=(0,s.visibleShifts)(i,de).filter(e=>e.date>=ge[0]&&e.date<=ge[6]),xe=(()=>{const e=new Date(ce);return e.setDate(e.getDate()-7),(0,D.ymd)(e)})(),be=pe.filter(e=>!e.published||e.changed).length,je=i.filter(e=>e.date>=xe&&e.date!!(0,s.leaveOn)(h,e,t),ke=ge.map(e=>(0,p.workingShifts)(pe,h).filter(t=>t.date===e).reduce((e,t)=>{return e+(ee(s=t)-te(ee(s)))*(d[s.staffId]??0);var s},0)),ye=ke.reduce((e,t)=>e+t,0),Ie=he.reduce((e,t)=>e+t,0),Se=(e,t)=>t?Math.round(e/t*100):0,Ce=de?l:l.filter(e=>e.id===a),De=(0,o.useNarrow)(),ve=Math.max(0,ge.indexOf((0,D.ymd)(t))),[Te,$e]=(0,r.useState)(null),Oe=Te??ve,Me=(e,t)=>!De||t===Oe,[Pe,Be]=(0,r.useState)(0),Re=le(Pe,De?1:7),Ae=Re.cell,ze=Re.name;return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Week",selected:'week'===Y,onPress:()=>E('week')}),(0,G.jsx)(m.Chip,{label:`Swaps & time off (${g.filter(e=>'open'===e.status).length+h.filter(e=>'pending'===e.status).length})`,selected:'requests'===Y,onPress:()=>E('requests')}),(0,G.jsx)(m.Chip,{label:"Availability",selected:'availability'===Y,onPress:()=>E('availability')})]}),'week'===Y?(0,G.jsxs)(G.Fragment,{children:[!de&&a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,G.jsx)(f.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,G.jsx)(m.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,F.timeSheetLabel)(ge[0],ge[6]),onPress:()=>{(0,F.setHoursPreset)(ge[0],ge[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,G.jsxs)(f.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Pe?Math.min(Pe,Re.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{S(j-1),R(null)},style:{minWidth:96}}),(0,G.jsxs)(f.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,G.jsxs)(m.T,{weight:"semibold",center:!0,children:["Week of ",(0,D.niceDate)(ce)]}),(0,G.jsxs)(m.Muted,{center:!0,children:[0===j?'This week':1===j?'Next week':-1===j?'Last week':j>0?`In ${j} weeks`:-j+" weeks ago",de?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{S(j+1),R(null)},style:{minWidth:96}})]}),(0,G.jsx)(f.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,G.jsx)(m.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:P.openCal,style:{minWidth:96}})}),(0,G.jsx)(_.AppDateCalendar,{visible:P.calOpen,today:(0,D.ymd)(t),day:(0,D.ymd)(ce),idPrefix:"rota-cal",onClose:P.closeCal,onDay:e=>{S((0,_.weekOffsetOf)(e??(0,D.ymd)(t),(0,D.ymd)(t))),R(null)}}),de?(0,G.jsxs)(m.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,G.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy last week"+(je?` (${je})`:''),disabled:!je,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(xe,ge[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,G.jsx)(m.Button,{small:!0,kind:"success",label:be?`Publish ${be} ${1===be?'change':'changes'}`:'Week published',disabled:!be,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(ge[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),be?(0,G.jsx)(m.Badge,{kind:"amber",label:`${be} unpublished`}):pe.length?(0,G.jsx)(m.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,B?(0,G.jsx)(m.Banner,{kind:"success",title:B}):null,De?(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:O.DAY3.map((e,t)=>K.IS_CAR?(0,G.jsx)(m.Button,{kind:t===Oe?'primary':'secondary',label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,accessibilityLabel:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}${t===Oe?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>$e(t),style:{minHeight:64,minWidth:96}},e):(0,G.jsx)(m.Chip,{label:`${e} ${(0,D.parseYmd)(ge[t]).getDate()}`,selected:t===Oe,onPress:()=>$e(t)},e))}):null,(0,G.jsx)(f.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Pe)>1&&Be(t)},style:{alignSelf:'stretch'},children:(0,G.jsx)(re,{fits:De||Re.fits,children:(0,G.jsxs)(f.default,{testID:"rota-grid",style:{gap:oe,width:Re.width,alignSelf:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:oe,backgroundColor:v.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:v.colours.hairline,zIndex:5},De||Re.fits?ie:null],children:[(0,G.jsx)(f.default,{style:{width:ze,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:11,weight:"semibold",colour:v.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),O.DAY3.map((e,s)=>(0,G.jsx)(f.default,{testID:"rota-date",style:{width:Ae,alignItems:'center'},children:(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,colour:ge[s]===(0,D.ymd)(t)?v.colours.gold:v.colours.text,children:[e," ",(0,D.parseYmd)(ge[s]).getDate()]})},e)).filter(Me)]}),Ce.map(e=>(0,G.jsxs)(f.default,{testID:"rota-row",style:{flexDirection:'row',gap:oe,alignItems:'center'},children:[(0,G.jsxs)(f.default,{testID:"rota-name",style:{width:ze,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:28}),(0,G.jsxs)(f.default,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(m.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,G.jsx)(m.T,{size:11,colour:v.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),O.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(pe,e.id,ge[n]),o=(c[e.id]??[]).includes(n),l=we(e.id,ge[n]),i=(0,x.rotaCellWorked)(a,b,e.id,ge[n],de),r=!(!de||!i.workedLine&&!i.onShiftNow);return(0,G.jsxs)(u.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${O.DAY3[n]}, ${i.speech}${(0,U.badgeSpoken)(a?.badge)}${l?', on time off':''}${o?', unavailable':''}`,disabled:!de,onPress:()=>{a?N({staffId:e.id,date:ge[n],shift:a}):z({staffId:e.id,date:ge[n]})},style:({pressed:e})=>({width:Ae,minHeight:K.IS_CAR?64:r?80:52,height:r||(0,U.cleanBadge)(a?.badge)||K.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:i.differs?v.colours.amber:a?a.published?v.colours.gold:v.colours.amber:v.colours.border,backgroundColor:e?v.colours.goldTint:a?a.published?'#2b2414':'#241f14':l?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,U.cleanBadge)(a?.badge)?6:0}),children:[a?(0,G.jsxs)(m.T,{size:Re.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,O.fmtH)(a.start),"\u2013",(0,O.fmtH)(a.end)]}):i.workedLine?null:(0,G.jsx)(m.T,{size:12,center:!0,colour:v.colours.muted,children:l?'Off':o?'Unavail.':de?'Add':'\u2013'}),(0,U.cleanBadge)(a?.badge)?(0,G.jsx)(f.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:v.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,G.jsx)(m.T,{size:10,weight:"semibold",colour:v.colours.gold,center:!0,numberOfLines:1,children:(0,U.cleanBadge)(a?.badge)})}):null,i.workedLine?(0,G.jsx)(m.T,{testID:"rota-worked",size:10,colour:i.differs?v.colours.amber:v.colours.goldLight,center:!0,children:i.workedLine}):null,i.onShiftNow?(0,G.jsx)(m.T,{testID:"rota-on-shift-now",size:10,colour:v.colours.goldLight,center:!0,children:"On shift now"}):null,i.diffLabel?(0,G.jsx)(m.T,{size:10,colour:v.colours.amber,center:!0,children:i.diffLabel}):null,a&&l?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.blue,children:(0,p.leaveLabel)((0,s.leaveOn)(h,e.id,ge[n])).toLowerCase()}):a&&o?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.red,children:"unavailable"}):!a||!de||a.published&&!a.changed||i.workedLine||i.onShiftNow?null:(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter(Me)]},e.id)),de?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe,marginTop:4},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour"})}),ke.map((e,t)=>(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,children:(0,C.gbp)(e).replace('.00','')})},t)).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{testID:"rota-sales-row",style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:'example'===ue.mode?'Sales (ex.)':'Sales'})}),ue.days.map((e,t)=>{const s=e.pence,n=e.kind,a='shut'===n?'shut':'none'!==n&&s?`\xa3${Math.round(s/100)}`:'\u2013',o='shut'===n?`${O.DAY3[t]} shut`:'actual'===n?`${O.DAY3[t]} sales \xa3${Math.round(s/100)} actual`:'forecast'===n?`${O.DAY3[t]} forecast sales \xa3${Math.round(s/100)}`:`${O.DAY3[t]} no sales figure`;return(0,G.jsxs)(f.default,{testID:"rota-sales-cell",accessible:!0,accessibilityLabel:o,style:{width:Ae,alignItems:'center'},children:[(0,G.jsx)(m.T,{size:12,center:!0,colour:'actual'===n?v.colours.text:v.colours.muted,children:a}),'forecast'===n&&s?(0,G.jsx)(m.T,{size:10,center:!0,colour:v.colours.muted,children:"fcst"}):null]},t)}).filter(Me)]}),fe?null:(0,G.jsxs)(f.default,{style:{flexDirection:'row',gap:oe},children:[(0,G.jsx)(f.default,{style:{width:ze},children:(0,G.jsx)(m.Muted,{children:"Labour %"})}),ke.map((e,t)=>{const s=Se(e,he[t]);return(0,G.jsx)(f.default,{style:{width:Ae,alignItems:'center'},children:(0,G.jsx)(m.T,{size:12,center:!0,weight:"semibold",colour:he[t]?s>32?v.colours.red:s>26?v.colours.amber:v.colours.ok:v.colours.muted,children:he[t]?`${s}%`:'\u2013'})},t)}).filter(Me)]})]}):null]})})}),!de&&a?(0,G.jsx)(f.default,{testID:"rota-team-on",children:(0,G.jsx)(m.Card,{children:ge.map((e,t)=>(0,G.jsx)(w.TeamOnDay,{date:e,meId:a,label:(0,D.niceDate)((0,D.parseYmd)(e))},e)).filter(Me)})}):null,de&&fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Labour this week"}),(0,G.jsx)(f.default,{testID:"labour-week-cost",children:(0,G.jsx)(m.T,{weight:"semibold",children:(0,C.gbp)(ye)})})]}),(0,G.jsxs)(m.Muted,{children:[(0,C.gbp)(ye)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,G.jsx)(m.Muted,{children:`Forecasts start once CoverCharge has ${1===ue.weeks?'1 week':`${ue.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ue.booked?(0,G.jsx)(f.default,{testID:"labour-booked",children:(0,G.jsxs)(m.T,{children:["Booked so far: ",ue.booked," Covers this week"]})}):null]})}):null,de&&!fe?(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:"labour-vs-sales",style:{gap:6},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:me.title}),(0,G.jsxs)(m.Row,{gap:6,children:['example'===ue.mode?(0,G.jsx)(H.ExampleBadge,{}):null,(0,G.jsx)(m.Badge,{kind:Se(ye,Ie)>30?'red':'ok',label:`${Se(ye,Ie)}% this week`})]})]}),(0,G.jsxs)(m.Muted,{testID:"sales-mix-words",children:[(0,C.gbp)(ye)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs ",(0,C.gbp)(Ie)," sales",ue.mixWords?` (${ue.mixWords})`:'',". Target 25\u201330%. ",me.bodyTail]}),(()=>{const e=Se(ke[5],he[5]),t=ue.days[5]?.kind;return e&&e<24&&'forecast'===t?(0,G.jsxs)(m.T,{size:14,colour:v.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]})}):null,de?(0,G.jsx)(m.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(T.SectionHead,{title:"Shift swaps & cover"}),g.filter(e=>de||e.fromId===a||e.toId===a).map(e=>{const t=i.find(t=>t.id===e.shiftId),n=l.find(t=>t.id===e.fromId),a=l.find(t=>t.id===e.toId);return(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,G.jsxs)(m.Muted,{children:[t?`${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:l.filter(e=>X(n,e)).map(t=>(0,G.jsx)(m.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,G.jsx)(m.Button,{small:!0,label:"Approve",disabled:!e.toId||!X(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(l.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,$.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${O.DAY3[t.day]} ${(0,O.fmtH)(t.start)}\u2013${(0,O.fmtH)(t.end)})`:''}`)}}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),de?null:(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,G.jsx)(m.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,G.jsx)(m.Muted,{testID:"swap-dept-note",children:(0,k.isAnchorageVenue)(y.VENUE_RID)?k.ANCHORAGE_SWAP_NOTE:Q(l.find(e=>e.id===a))?k.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),pe.filter(e=>e.staffId===a).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=g.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,G.jsxs)(f.default,{style:{gap:4,paddingVertical:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:14,weight:"medium",children:[O.DAY3[e.day]," ",(0,O.fmtH)(e.start),"\u2013",(0,O.fmtH)(e.end),(0,U.cleanBadge)(e.badge)?` \xb7 ${(0,U.cleanBadge)(e.badge)}`:'']}),t?(0,G.jsx)(m.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,kind:'cover',note:'Can anyone cover?'}),(0,$.autoPost)('all',`Cover needed: ${O.DAY3[e.day]} ${(0,O.fmtH)(e.start)}\u2013${(0,O.fmtH)(e.end)} (${(l.find(e=>e.id===a)?.name??'').replace(' (example)','')})`)}}),l.filter(e=>X(l.find(e=>e.id===a),e)).map(t=>(0,G.jsx)(m.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:a,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),pe.some(e=>e.staffId===a)?null:(0,G.jsx)(m.Muted,{children:"No shifts on the rota this week."})]}),(0,G.jsx)(T.SectionHead,{title:"Holiday & time off"}),de?(0,G.jsx)(m.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>J(!0)}):a?(0,G.jsx)(I.RequestTimeOff,{meId:a,me:Z,testID:"rota-requests-time-off"}):null,h.filter(e=>de||e.staffId===a).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,G.jsx)(m.Card,{children:(0,G.jsxs)(f.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(l.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,G.jsx)(m.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,G.jsxs)(m.Muted,{children:[(0,I.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&de?(0,G.jsxs)(m.Row,{gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),de&&a?(0,G.jsx)(I.TimeOffSheet,{visible:q,onClose:()=>J(!1),meId:a,me:Z,manager:!0}):null]}):null,'availability'===Y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.Muted,{children:["Days each person can\u2019t work. ",de?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ce.filter(e=>'owner'!==e.role||!de).map(e=>(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{gap:8,children:[(0,G.jsx)(M.StaffAvatar,{id:e.id,size:30}),(0,G.jsx)(m.T,{weight:"semibold",children:e.name})]}),(0,G.jsx)(m.Row,{wrap:!0,gap:4,children:O.DAY3.map((t,n)=>{const a=(c[e.id]??[]).includes(n);return(0,G.jsx)(m.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,L?(0,G.jsx)(V.AssignRoleSheet,{name:(l.find(e=>e.id===L.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,D.niceDate)((0,D.parseYmd)(L.date))} \xb7 ${(0,O.fmtH)(L.shift.start)}\u2013${(0,O.fmtH)(L.shift.end)}`,current:L.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,U.assignShiftBadge)(s.useOwner.getState().shifts,L.shift.id,e)),N(null)},onEditTimes:()=>{z(L),N(null)},onClose:()=>N(null)}):null,A?(0,G.jsx)(ae,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:o,meId:h,me:g,r:p,rid:x}=(0,O.useCtx)(5e3),b=((0,P.useClockArea)(e=>e.areas[x]),(0,P.areaOf)(x));const w=(0,B.privateClockVenue)(x),[k,y]=(0,r.useState)(!1),[I,S]=(0,r.useState)(!1),C=(0,s.useOwner)(e=>e.consent[h]),T=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),$=(0,s.useOwner)(e=>e.shifts),[H,N]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),[F,E]=(0,r.useState)(null),[_,q]=(0,r.useState)(void 0),[U,V]=(0,r.useState)(null),[K,Q]=(0,r.useState)(!1),[X,J]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[te,se]=(0,r.useState)(!1),ne=T.filter(t=>t.staffId===h&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],ae=ne&&(0,s.isOnBreak)(ne)?ne.breaks[ne.breaks.length-1]:void 0,oe=(0,s.visibleShifts)($,'staff'!==o).find(e=>e.staffId===h&&e.date===t),le='staff'!==o,ie=ne?(0,O.paidMins)({in:ne.in},e).worked:0,re=b.on&&(0,R.areaSet)(b),ue=ne?.geo?.[ne.geo.length-1],he=T.filter(e=>e.staffId===h&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],fe=(0,d.useClockNotSent)(ne?.id??U?.id??he?.id),[me,ge]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(fe)ge(!0);else if(me){const e=setTimeout(()=>ge(!1),6e3);return()=>clearTimeout(e)}},[fe]);const pe=!fe&&me;(0,r.useEffect)(()=>{if(!te)return;const e=setTimeout(()=>se(!1),4e3);return()=>clearTimeout(e)},[te]);const xe=async(s,n={})=>{W(s),E(null),q(void 0);const a=await(0,A.clockAction)(s,{rid:x,staffId:h,date:t,at:new Date(e.getTime()).toISOString(),...n});return W(null),!a.ok&&a.reclock?(ee(a.reclock),!1):a.ok?('out'===s&&a.att&&(V(a.att),se(!0),(0,i.hrSettingsOf)(p.settings?.hr).on&&!l.useHr.getState().hasAnswered(x,a.att.id)&&J(a.att)),'in'===s&&V(null),a.att&&(0,d.markClockUnsent)(a.att.id),!0):(E(a.message),q(a.fix),(0,z.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return C?(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.Row,{gap:10,style:{flex:1},children:[(0,G.jsx)(M.StaffAvatar,{id:h,size:48}),(0,G.jsx)(m.T,{weight:"semibold",style:{flex:1},children:g})]}),(0,G.jsx)(m.Badge,{kind:ne?'ok':'neutral',label:ne?`On shift since ${(0,D.hm)(new Date(ne.in))}`:'Not clocked in'})]}),(0,G.jsx)(m.Muted,{children:oe?`Today's shift: ${(0,O.fmtH)(oe.start)}\u2013${(0,O.fmtH)(oe.end)}`:'No shift on the rota today'}),(0,G.jsx)(f.default,{testID:"clock-area-line",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.muted,children:re?w?`Location is checked only when you choose Clock in, at ${p.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${p.name}.`:b.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ue&&!0===ue.inside&&null!=ue.dist?(0,G.jsxs)(m.Muted,{children:["Last check: at the venue (about ",ue.dist," m from the centre)."]}):null,ne?(0,G.jsx)(m.T,{size:30,weight:"bold",center:!0,children:(0,O.hmDur)(ie)}):null,ne&&ae?(0,G.jsx)(f.default,{testID:"on-break",children:(0,G.jsxs)(m.T,{size:15,weight:"semibold",colour:v.colours.gold,center:!0,children:["On a break since ",(0,D.hm)(new Date(ae.start))," \xb7 ",(0,s.loggedBreakMins)(ne,e)," min so far"]})}):null,!ne&&te?(0,G.jsx)(f.default,{testID:"clock-just-out",accessible:!0,accessibilityRole:"text",accessibilityLabel:"Clocked out",style:{minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,G.jsx)(m.T,{size:17,weight:"semibold",colour:v.colours.ok,center:!0,children:"\u2713 Clocked out"})}):ne?(0,G.jsxs)(G.Fragment,{children:[ae?(0,G.jsx)(m.Button,{testID:"break-end",kind:"success",label:'break_end'===Y?'Checking your location\u2026':'End break',disabled:!!Y,onPress:()=>{xe('break_end')}}):(0,G.jsx)(m.Button,{testID:"break-start",kind:"secondary",label:'break_start'===Y?'Checking your location\u2026':'Start break',disabled:!!Y,onPress:()=>{xe('break_start')}}),(0,G.jsx)(m.Button,{testID:"clock-out",kind:"danger",label:'out'===Y?'Checking your location\u2026':'Clock out',disabled:!!Y,onPress:()=>{ne.breaks?.length?xe('out'):(E(null),N(!0))}})]}):(0,G.jsx)(m.Button,{testID:"clock-in",kind:"success",label:'in'===Y?'Checking your location\u2026':'Clock in',disabled:!!Y,onPress:()=>{const e=(0,a.recentClockOut)(T,h,new Date);e?ee(e):w?y(!0):xe('in')}}),fe?(0,G.jsxs)(f.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:v.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,G.jsx)(m.T,{size:18,weight:"bold",colour:v.colours.gold,center:!0,children:"Not sent yet"}),(0,G.jsx)(m.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,G.jsx)(m.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{c.mutationQueue.retryNow()}})]}):pe?(0,G.jsx)(f.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,G.jsx)(m.T,{size:14,colour:v.colours.ok,center:!0,children:"\u2713 Sent"})}):null,ne?.breaks?.length?(0,G.jsxs)(m.Muted,{center:!0,children:["Breaks today: ",ne.breaks.map(e=>`${(0,D.hm)(new Date(e.start))}\u2013${e.end?(0,D.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(ne,e)," min)"]}):null,F?(0,G.jsx)(f.default,{testID:"clock-message",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Not recorded",children:F})}):null,F&&'settings'===_?(0,G.jsx)(m.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:L.openAppSettings}):null,F&&'location'===_?(0,G.jsx)(m.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:L.openLocationSettings}):null,F&&'update'===_?(0,G.jsx)(m.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:L.checkAppUpdate}):null]}),le&&!(0,R.areaSet)(b)?(0,G.jsx)(f.default,{testID:"clock-area-warning",children:(0,G.jsx)(m.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,G.jsx)(u.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>Q(!0),style:{alignSelf:'center',padding:6},children:(0,G.jsx)(m.T,{size:14,colour:v.colours.gold,children:"Forgot to clock in or out?"})}),K?(0,G.jsx)(ce,{onClose:()=>Q(!1)}):null,(0,G.jsx)(j.BreakRoomCard,{staffId:h,name:g,now:e}),U?(()=>{const t=(0,O.paidMins)(U,e);return(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsxs)(m.T,{weight:"semibold",colour:v.colours.gold,children:["Clocked out at ",(0,D.hm)(new Date(U.out))]}),(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Clocked ",(0,O.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,O.hmDur)(t.paid)]}),(0,G.jsxs)(m.Muted,{children:["In ",(0,D.hm)(new Date(U.in))," \xb7 out ",(0,D.hm)(new Date(U.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",U.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,G.jsx)(m.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,G.jsx)(m.Sheet,{visible:k||I,onClose:()=>{y(!1),S(!1)},title:"Why we ask for location",testID:"clock-location-reason",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsxs)(m.T,{children:["We check once that you are at ",p.name,", within about ",b.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,G.jsx)(m.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,G.jsx)(m.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{const e=I;y(!1),S(!1),xe('in',e?{reclock:!0}:{})}}),(0,G.jsx)(m.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>{y(!1),S(!1)}})]})}),le?(0,G.jsx)(de,{rid:x,today:t,now:e}):null,(0,G.jsx)(m.Sheet,{visible:!!Z,onClose:()=>ee(null),title:"Clock in again?",testID:"clock-reclock",children:(0,G.jsxs)(f.default,{style:{gap:12},children:[(0,G.jsx)(m.T,{testID:"clock-reclock-text",accessibilityRole:"header",children:Z?(0,a.reclockQuestion)(Z):''}),(0,G.jsx)(m.Button,{testID:"clock-reclock-no",kind:"secondary",label:"No, stay clocked out",accessibilityLabel:"No, stay clocked out",onPress:()=>ee(null)}),(0,G.jsx)(m.Button,{testID:"clock-reclock-yes",kind:"success",label:"Yes, clock in again",accessibilityLabel:"Yes, clock in again",onPress:()=>{ee(null),w?S(!0):xe('in',{reclock:!0})}})]})}),X?(0,G.jsx)(n.ShiftCheckout,{rid:x,shiftKey:X.id,day:X.date,meId:h,onClose:()=>J(null)}):null,(0,G.jsx)(m.Sheet,{visible:H,onClose:()=>N(!1),title:"Did you take a break? If so, how long?",children:(0,G.jsxs)(f.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,G.jsx)(m.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:b.breakOptions.map(e=>(0,G.jsx)(m.Chip,{testID:`forgot-break-${e}`,label:(0,R.breakLabel)(e),disabled:e>=ie,onPress:()=>{N(!1),xe('out',{addedBreak:e})}},e))}),(0,G.jsx)(m.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{N(!1),xe('out',{breakMins:0})}}),ie>360?(0,G.jsx)(m.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,G.jsx)(m.Muted,{children:w?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,G.jsx)(f.default,{style:{gap:10},children:(0,G.jsxs)(m.Card,{highlight:v.colours.gold,children:[(0,G.jsx)(m.T,{weight:"semibold",colour:v.colours.gold,children:"Before you clock in: location & your privacy"}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(m.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",p.name,", within about ",b.radius," m."]}),(0,G.jsx)(m.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,G.jsxs)(G.Fragment,{children:[" ",(0,G.jsxs)(m.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,G.jsx)(m.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",p.name," (within about ",b.radius," m)."]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,G.jsx)(m.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,G.jsx)(m.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(h,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,O.useCtx)(3e4);return s!=='staff'?(0,G.jsx)(he,{now:e,today:t,meId:n}):(0,G.jsx)(ue,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]);_r(_d[10]);var u=e(_r(_d[11])),h=e(_r(_d[12])),f=e(_r(_d[13])),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),P=_r(_d[32]),B=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),Y=_r(_d[40]),W=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),U=_r(_d[46]),V=_r(_d[47]),K=_r(_d[48]),G=_r(_d[49]);const Q=e=>(0,k.deptKey)(e?.dept),X=(e,t)=>(0,k.canSwapWith)(e,t,y.VENUE_RID),J=2650,Z=1900,ee=e=>e.end-e.start,te=e=>e>8?.5:e>6?.3333333333333333:0,se=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,O.weekday)(e)),t};function ne(e){const{rid:t,r:s,now:n}=(0,O.useCtx)(6e4),a=(0,g.useBookings)(t),o=(0,g.useOrders)(t),l=(0,g.useEvents)(t),i=(0,N.useCashUp)(e=>e.cashUps),d=(0,H.useRealHistory)(t,n);return(0,r.useMemo)(()=>{const r=Array.from({length:7},(t,s)=>{const n=(0,D.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),c=(0,Y.clampWeeks)(s.settings.forecastMinWeeks);if(!d){const i=r.map(e=>{const t=(0,S.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*J+t.restOfDay.takeaway*Z:0});return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:[],bookings:a,minWeeks:c,exampleSales:i})}return(0,W.weekSalesForRota)({rid:t,mon:e,now:n,kitchenHours:s.kitchenHours,cashUps:i,bookings:a,minWeeks:c})},[s,a,o,l,i,d,(0,D.ymd)(e)])}function ae({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,r.useState)(e.shift?.start??12),[l,i]=(0,r.useState)(e.shift?.end??20),[d,c]=(0,r.useState)(e.shift?.breakAt),[u,h]=(0,r.useState)((0,U.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,G.jsxs)(m.Sheet,{visible:!0,onClose:t,title:(0,q.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,G.jsx)(m.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,I.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,G.jsx)(m.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,G.jsx)(m.Chip,{label:"None",selected:!u,onPress:()=>h(void 0),testID:"shift-badge-none"}),U.ROLE_BADGES.map(e=>(0,G.jsx)(m.Chip,{label:e,selected:u===e,onPress:()=>h(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,G.jsx)(m.Chip,{label:`${e} ${(0,O.fmtH)(t)}\u2013${(0,O.fmtH)(s)}`,selected:a===t&&l===s,onPress:()=>{o(t),i(s)}},e))}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{children:"Start"}),(0,G.jsx)(m.Stepper,{testID:"shift-start",value:a,step:.5,min:q.SHIFT_MIN_START,max:l-1,onChange:o,format:O.fmtH,label:"Start time"})]}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:"End"}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.Stepper,{testID:"shift-end",value:l,step:.5,min:a+1,max:q.SHIFT_MAX_END,onChange:i,format:O.fmtH,label:"End time"}),l>=24?(0,G.jsx)(m.Muted,{children:"next day"}):null]})]}),(0,G.jsxs)(m.Muted,{children:[(l-a).toFixed(1),"h scheduled",te(l-a)?`, ${Math.round(60*te(l-a))}m planned break`:'']}),(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,G.jsx)(m.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,G.jsx)(m.Chip,{label:"Set a break time",onPress:()=>c(Math.min(l-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(l-a)/2)))/4)))}):(0,G.jsxs)(m.Row,{gap:6,children:[(0,G.jsx)(m.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:l-.25,onChange:c,format:O.fmtH,label:"Break time"}),(0,G.jsx)(m.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,G.jsx)(m.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,G.jsx)(m.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:l,breakAt:g?d:void 0,badge:(0,U.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:l,...void 0!==d&&g?{breakAt:d}:{},...(0,U.cleanBadge)(u)?{badge:(0,U.cleanBadge)(u)}:{}}),t()}}),(0,G.jsx)(m.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,G.jsx)(m.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const oe=6;function le(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*oe:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+oe),big:o>=104,fits:!e||s+t*(o+oe)<=e}}const ie={position:'sticky',top:0};function re({fits:e,children:t}){return e?(0,G.jsx)(f.default,{style:{alignItems:'center'},children:t}):(0,G.jsx)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function de({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,O.useSignedIn)(),{me:i,meId:d}=(0,O.useCtx)(3e4),[c,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(''),[g,p]=(0,r.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,A.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:l?.id??d,name:l?.name??i},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,z.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),f(''),p(null)};return(0,G.jsxs)(m.Card,{children:[(0,G.jsx)(m.T,{weight:"semibold",children:"Record it for someone"}),(0,G.jsx)(m.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:a.map(e=>(0,G.jsx)(m.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Field,{label:"Reason (kept with the record)",value:h,onChangeText:f,placeholder:"e.g. Phone out of battery"}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,G.jsx)(m.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:g}):null]}):null]})}function ce({onClose:e}){const{now:t,today:n,meId:a}=(0,O.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),l=(0,s.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),[d,c]=(0,r.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(l,!1).find(e=>e.staffId===a&&e.date===d),[f,g]=(0,r.useState)(u&&!u.out?'out':'in'),[p,x]=(0,r.useState)(h?Math.round(60*h.start):720),[j,w]=(0,r.useState)(h?Math.round(60*h.end):1200),[k,y]=(0,r.useState)(''),[I,S]=(0,r.useState)(!1),C=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==f,$='in'!==f,M=T&&$&&j<=p,P=(e,t)=>(0,G.jsx)(m.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,G.jsx)(m.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,G.jsx)(m.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,G.jsx)(m.Button,{label:"Done",onPress:e})]}):(0,G.jsxs)(m.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,G.jsx)(m.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,children:i.map(e=>(0,G.jsx)(m.Chip,{label:e===n?'Today':(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,G.jsxs)(m.Muted,{children:[h?`Your rota that day: ${(0,O.fmtH)(h.start)}\u2013${(0,O.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,D.hm)(new Date(u.in))}\u2013${u.out?(0,D.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,G.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,G.jsx)(m.Chip,{label:"Forgot to clock in",selected:'in'===f,onPress:()=>g('in')}),(0,G.jsx)(m.Chip,{label:"Forgot to clock out",selected:'out'===f,onPress:()=>g('out')}),(0,G.jsx)(m.Chip,{label:"Forgot both",selected:'both'===f,onPress:()=>g('both')})]}),T?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["In ",C(p)]}),P(x,p)]}):null,$?(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(m.T,{size:18,weight:"bold",children:["Out ",C(j),j>=1440?' (next day)':'']}),P(w,j)]}):null,M?(0,G.jsx)(m.T,{size:13,colour:v.colours.red,children:"Clock-out must be after clock-in."}):null,(0,G.jsx)(m.Field,{label:"Note for your manager (optional)",value:k,onChangeText:y,placeholder:"e.g. phone died",maxLength:200}),(0,G.jsx)(m.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:f,suggestedIn:T?(0,b.isoAt)(d,p):void 0,suggestedOut:$?(0,b.isoAt)(d,j):void 0,note:k.trim(),at:t.toISOString()}),S(!0)}})]})}function ue(){const{now:e,today:t,meId:n}=(0,O.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),l=(0,s.useOwner)(e=>e.timeRequests),[i,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),h=(0,D.ymd)(se(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=h),x=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),w=l.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,G.jsxs)(f.default,{style:{gap:10},testID:"my-timesheet",children:[(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,G.jsxs)(f.default,{children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,G.jsx)(m.T,{size:28,weight:"bold",colour:v.colours.ok,children:(0,O.hmDur)(x)})]}),(0,G.jsxs)(f.default,{style:{alignItems:'flex-end'},children:[(0,G.jsx)(m.T,{size:12,colour:v.colours.muted,children:"PENDING SIGN-OFF"}),(0,G.jsx)(m.T,{size:18,weight:"semibold",colour:j?v.colours.amber:v.colours.muted,children:(0,O.hmDur)(j)})]})]}),(0,G.jsx)(m.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,G.jsx)(m.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,G.jsx)(T.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsxs)(m.T,{size:14,children:[(0,D.niceDate)((0,D.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,G.jsxs)(m.Muted,{children:[e.suggestedIn?`in ${(0,D.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,D.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,G.jsx)(m.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,G.jsx)(T.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,O.paidMins)(t,e),l=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,G.jsxs)(m.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsxs)(f.default,{style:{flex:1},children:[(0,G.jsx)(m.T,{weight:"semibold",children:(0,D.niceDate)((0,D.parseYmd)(t.date))}),(0,G.jsxs)(m.Muted,{children:[(0,D.hm)(new Date(t.in)),"\u2013",t.out?(0,D.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,O.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,O.fmtH)(n.start)}\u2013${(0,O.fmtH)(n.end)}`:'']})]}),(0,G.jsx)(m.Badge,{kind:(0,b.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,b.statusLabel)(t)})]}),l?(0,G.jsxs)(m.T,{size:13,colour:v.colours.gold,children:["Adjusted by ",l.by.replace(' (example)',''),l.reason?`: ${l.reason}`:'']}):null,t.signOff?(0,G.jsxs)(m.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,G.jsx)(b.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,G.jsx)(m.Muted,{children:"No clocked shifts yet."}),i?(0,G.jsx)(ce,{onClose:()=>d(!1)}):null]})}function he({now:e,today:n}){const a=(0,s.useOwner)(e=>e.staff),l=(0,s.useOwner)(e=>e.shifts),i=(0,O.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),c=(0,s.useOwner)(e=>e.timeRequests),h=(0,s.useOwner)(e=>e.leave),g=(0,s.useOwner)(e=>e.attLog),[x,j]=(0,r.useState)(n),[w,k]=(0,r.useState)(null),[y,I]=(0,r.useState)(!1),[S,$]=(0,r.useState)(!1),P=!!(0,O.useSignedIn)(),B=S?(0,F.pastWeekDays)(x,n):Array.from({length:7},(e,t)=>(0,D.ymd)((0,D.addMins)((0,D.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===x&&e.in),A=l.filter(e=>e.date===x&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>B.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),N=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,O.paidMins)(s,e).paid,0),Y=L.reduce((t,s)=>t+(0,O.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),W=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=a.find(e=>e.id===t.staffId),o=(0,s.shiftOf)(l,t.staffId,t.date),r=(0,O.paidMins)(t,e),d=i[t.staffId]??0;return`${n?.name},${t.date},${o?`${(0,O.fmtH)(o.start)}-${(0,O.fmtH)(o.end)}`:'-'},${(0,D.hm)(new Date(t.in))},${(0,D.hm)(new Date(t.out))},${r.brk},${(r.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(r.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':n?.noTax&&P?'No tax deducted':''}`}));return(0,G.jsxs)(f.default,{style:{gap:10},children:[(0,G.jsx)(E.HoursDayPicker,{testID:"ts-pick",date:x,today:n,custom:S,onDate:e=>{j(e),$(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),$(!1)}}),(0,G.jsx)(m.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:B.map(e=>(0,G.jsx)(m.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,F.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':S?(0,F.chipDay)(e):(0,D.niceDate)((0,D.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,G.jsxs)(m.Card,{children:[(0,G.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,G.jsx)(m.T,{weight:"semibold",testID:"ts-week-title",children:S?(0,F.weekTitle)(x,n):'Last 7 days'}),(0,G.jsx)(m.Badge,{kind:"ok",label:`${(0,O.hmDur)(H)} confirmed`})]}),N?(0,G.jsxs)(m.T,{size:13,colour:v.colours.amber,children:[(0,O.hmDur)(N)," pending sign-off (not counted yet)"]}):null,(0,G.jsxs)(m.Muted,{children:["Labour cost ",(0,C.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,G.jsx)(o.WideTable,{children:(0,G.jsxs)(f.default,{style:{gap:2},children:[(0,G.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:v.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,G.jsx)(m.T,{size:12,weight:"semibold",colour:v.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(l,t.staffId,x),d=(0,O.paidMins)(t,e),h=(0,b.flagsFor)(t,r,e,n,c).map(e=>e.label);return(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,G.jsxs)(m.Row,{gap:4,style:{width:110},children:[(0,G.jsx)(M.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,G.jsx)(m.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:i?.name.replace(' (example)','')})]}),(0,G.jsx)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:r?`${(0,O.fmtH)(r.start)}\u2013${(0,O.fmtH)(r.end)}`:'\u2013'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:(0,D.hm)(new Date(t.in))}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?(0,D.hm)(new Date(t.out)):'on'}),(0,G.jsx)(m.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,G.jsx)(m.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,O.hmDur)(d.paid):`${(0,O.hmDur)(d.worked)}\u2026`}),(0,G.jsx)(m.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?v.colours.ok:'open'===(0,s.attStatus)(t)?v.colours.blue:v.colours.amber,children:(0,b.statusLabel)(t)}),(0,G.jsx)(m.T,{size:11,style:{width:140},colour:h.length?v.colours.amber:v.colours.ok,children:h.join(', ')||'OK'}),(0,G.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>k(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,G.jsx)(m.T,{size:12,colour:v.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,G.jsxs)(o.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,G.jsx)(m.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,G.jsxs)(m.T,{size:12,style:{width:86},colour:v.colours.muted,children:[(0,O.fmtH)(t.start),"\u2013",(0,O.fmtH)(t.end)]}),(()=>{const s=(0,p.leaveCovering)(h,t.staffId,t.date);return s?(0,G.jsxs)(m.T,{size:12,colour:v.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,p.leaveLabel)(s)," (rota covered)"]}):(0,G.jsx)(m.T,{size:12,colour:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?v.colours.muted:v.colours.red,children:x===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,G.jsx)(m.Muted,{children:"No shifts or clock records for this day."}),(0,G.jsx)(m.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,G.jsx)(m.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,G.jsx)(T.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),g.length?g.slice(0,12).map(e=>(0,G.jsxs)(m.Muted,{children:[(0,D.niceDate)(new Date(e.at))," ",(0,D.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,G.jsx)(m.Muted,{children:"No manual changes yet."}),w?(0,G.jsx)(b.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>k(null)}):null,(0,G.jsxs)(m.Sheet,{visible:y,onClose:()=>I(!1),title:"Payroll export",children:[(0,G.jsxs)(m.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",N?`${(0,O.hmDur)(N)} still pending sign-off is left out.`:'']}),(0,G.jsxs)(f.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[W.slice(0,14).map((e,t)=>(0,G.jsx)(m.T,{size:10,colour:t?v.colours.text:v.colours.gold,children:e},t)),W.length>14?(0,G.jsxs)(m.Muted,{children:["\u2026 ",W.length-14," more rows"]}):null]}),(0,G.jsxs)(m.Muted,{children:[W.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1196,[813,876,1197,1070,1177,923,924,17,975,976,219,385,278,85,777,858,1071,1198,1188,1163,1199,1059,805,1200,1140,851,863,804,1178,1161,1057,884,1012,912,913,1067,916,1069,1145,1008,1142,1143,1191,1193,1051,1060,1168,1167,856,8]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1197,[812,17,385,85,777,804,876,816,860,923,924,8]); __d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"hmClock",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"hmDur",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"plannedBreakMins",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"plannedNetMins",{enumerable:!0,get:function(){return d}}),e.breakMinutes=s,e.paidMinutes=l,Object.defineProperty(e,"isConfirmedAtt",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isOpenAtt",{enumerable:!0,get:function(){return h}}),e.attendanceOnDate=p,e.confirmedOnDate=b,e.openOnDate=m,e.diffLabelOf=w,e.rotaCellWorked=function(t,o,u,d,s){const c=t?`${(0,n.fmtH)(t.start)}\u2013${(0,n.fmtH)(t.end)}`:void 0;if(!s)return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'};const h=b(o,u,d);if(h?.in&&h.out){const n=l(h)??0,o=`Worked ${a(h.in)}\u2013${a(h.out)} \xb7 ${f(n)}`,u=t?w(t,h):{differs:!1},d=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift',`worked ${a(h.in)} to ${a(h.out)}, ${f(n)}`,u.diffLabel].filter(Boolean).join(', ');return{plannedLabel:c,workedLine:o,onShiftNow:!1,differs:u.differs,diffLabel:u.diffLabel,speech:d}}if(m(o,u,d)){const n=[c?`planned ${c.replace('\u2013',' to ')}`:'no planned shift','on shift now'].join(', ');return{plannedLabel:c,onShiftNow:!0,differs:!1,speech:n}}return{plannedLabel:c,onShiftNow:!1,differs:!1,speech:c?`planned ${c.replace('\u2013',' to ')}`:'no shift'}};var n=r(_d[0]);const t=n=>String(n).padStart(2,'0'),o=5,a=n=>{const o=new Date(n);return`${t(o.getHours())}:${t(o.getMinutes())}`},f=n=>`${Math.floor(Math.max(0,n)/60)}h ${t(Math.max(0,n)%60)}m`,u=n=>n>8?30:n>6?20:0,d=n=>{const t=Math.round(60*(n.end-n.start));return Math.max(0,t-u(n.end-n.start))};function s(n,t=new Date){if('number'==typeof n.breakMins)return n.breakMins;const o=t.getTime();return Math.round((n.breaks??[]).reduce((n,t)=>n+Math.max(0,(t.end?new Date(t.end).getTime():o)-new Date(t.start).getTime()),0)/6e4)}function l(n,t=new Date){if(!n.in)return null;const o=n.out?new Date(n.out):t,a=Math.max(0,Math.round((o.getTime()-new Date(n.in).getTime())/6e4));return Math.max(0,a-s(n,t))}const c=n=>!(n.voided||!n.in||!n.out||!n.signOff),h=n=>!n.voided&&!!n.in&&!n.out;function p(n,t,o){return n.filter(n=>n.staffId===t&&n.date===o&&!n.voided)}function b(n,t,o){const a=p(n,t,o).filter(c);if(!a.length)return null;if(1===a.length)return a[0];const f=a.reduce((n,t)=>n.inn.out>t.out?n:t),d=a.reduce((n,t)=>n+s(t),0);return{staffId:t,date:o,in:f.in,out:u.out,breakMins:d,signOff:f.signOff}}function m(n,t,o){return p(n,t,o).find(h)??null}function M(n){const t=new Date(n);return 60*t.getHours()+t.getMinutes()}function $(n){return(Math.round(60*n)%1440+1440)%1440}function w(n,t){const a=l(t),u=d(n);if(null==a)return{differs:!1};const s=Math.abs(M(t.in)-$(n.start)),c=t.out?Math.abs(M(t.out)-$(n.end>=24?n.end-24:n.end)):0,h=a-u;if(Math.abs(h)>o){const n=Math.abs(h);return{differs:!0,diffLabel:h>0?`${f(n)} longer than planned`:`${f(n)} shorter than planned`}}return s>o||c>o?{differs:!0,diffLabel:'Times differ from the plan'}:{differs:!1}}},1198,[1060]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:b}){const f=(0,o.useOwner)(e=>e.shifts),g=(0,o.useOwner)(e=>e.staff),j=(0,o.useOwner)(e=>e.leave),y=(0,s.useMemo)(()=>(0,c.teamOnDay)((0,h.workingShifts)(f,j),g,e,t),[f,j,g,e,t]);return(0,p.jsxs)(n.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(b,y),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,p.jsxs)(l.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",b]}),y.length?y.map(e=>(0,p.jsxs)(n.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(l.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,p.jsxs)(l.T,{size:13,center:!0,children:[e.name,e.job?(0,p.jsxs)(l.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,p.jsx)(l.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),p=r(d[7])},1199,[17,85,777,876,1059,804,1071,8]); @@ -1316,9 +1316,9 @@ __d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1233,[824,1234,831,834]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1234,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1235,[17,856,1232]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1236,[17,385,329,85,409,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1236,[17,385,329,85,409,804,1185,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1237,[13,17,775,856,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1238,[843,1099,861,13,17,1239,917,85,841,1240,1079,1055,777,845,851,1105,863,858,899,804,1181,848,995,998,1076,1107,1241,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return A}});var e,t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),s=_r(d[3]),i=_r(d[4]),l=_r(d[5]),a=_r(d[6]),r=_r(d[7]),u=(e=r)&&e.__esModule?e:{default:e},h=_r(d[8]),c=_r(d[9]),p=_r(d[10]),b=_r(d[11]),f=_r(d[12]),y=_r(d[13]),k=_r(d[14]),j=_r(d[15]),x=_r(d[16]),v=_r(d[17]),C=_r(d[18]),w=_r(d[19]),S=_r(d[20]),D=_r(d[21]),$=_r(d[22]),P=_r(d[23]),T=_r(d[24]),M=_r(d[25]),O=_r(d[26]),B=_r(d[27]);function A(){const{rid:e,date:r}=(0,s.useLocalSearchParams)(),A=(0,v.useRestaurant)(e),I=(0,v.useCustomer)(),R=(0,v.useBookings)(e),q=(0,v.useEvents)(e),z=(0,v.useNow)(6e4),[N]=(0,i.useState)(()=>(0,a.startForm)()),[F,W]=(0,i.useState)(''),[L,H]=(0,i.useState)(2),[E,_]=(0,i.useState)(0),Y=Math.min(E,Math.max(0,L-1)),[U,G]=(0,i.useState)(r??(0,x.ymd)(z)),[Q,V]=(0,i.useState)(null),[J,K]=(0,i.useState)(I.name),[X,Z]=(0,i.useState)(I.phone??''),[ee,te]=(0,i.useState)(I.email??''),[oe,ne]=(0,i.useState)(!1),[se,ie]=(0,i.useState)(''),[le,ae]=(0,i.useState)(!1),[re,de]=(0,i.useState)(!1),[ue,he]=(0,i.useState)([]),[ce,ge]=(0,i.useState)(!1),me=[...I.allergies,...ue.filter(e=>!I.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[pe,be]=(0,i.useState)(null),fe=(0,$.useBlocks)(e=>e.blocks);(0,C.usePublicDayStore)(e=>e.n);const ye=e?(0,C.publicDay)(e,U):null,ke=ye?[...ye.bookings,...R.filter(e=>e.date!==U)]:R,je=ye?[...fe.filter(t=>t.rid!==e||t.date!==U),...ye.blocks]:fe,xe=(0,P.usePlan)(e),[ve,Ce]=(0,i.useState)((0,M.emptyNeeds)()),we=!0===ve.dog,Se=we?ve.dogs:0;if(!A)return(0,B.jsx)(f.Screen,{title:"Not found",children:(0,B.jsx)(f.T,{children:"Restaurant not found."})});const De=A.settings,$e=(0,x.parseYmd)(U),Pe=(0,j.onlinePartyBounds)(A),Te=(0,$.blocksOn)(je,A.id,U),Me=ke.filter(e=>e.date===U),Oe=xe.areas.filter(e=>e.dogs),Be=(0,b.dogSetUp)(xe),Ae=e=>(0,T.freeTablesAt)(xe,Me,L,new Date(`${U}${(0,t.tableNumbers)(e)}:00`),(0,T.turnFor)(L,De.turnMins),De.turnMins,{dog:!0,closed:(0,$.closedAreasAt)(je,A.id,U,e)}),Ie=(0,j.bookingSlots)(A,$e,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),L,z,e=>ke.filter(t=>t.date===U&&t.time===e&&!['cancelled','noshow'].includes(t.status)).length).map(e=>{const t=(0,$.blockAt)(je,A.id,U,e.time),o=we&&Be&&e.available&&!t&&(!Ae(e.time).length||!(0,M.dogTimeOk)(A,ke,U,e.time,Se));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),Re=Ie.some(e=>e.available),qe=(0,h.depositOf)(De),ze=(0,p.bookingRulesOf)(A),Ne=(0,p.bookingDepositSplit)(qe,L,Y,(0,M.needsPatch)(ve,I.allergies),(0,b.reservablesOf)(A)),Fe=Ne.total,We=(0,h.depositDue)(qe,L,Y),Le=(0,p.dogPartyCheck)(ze,L,we,ve.assistDog,A.phone),He=(0,p.largeGroupTables)(ze,L),Ee=(0,p.emailRequired)(ze,'online'),Ye=Fe>0?'deposit':'none',Ue=(0,h.depositWords)(qe,L,A.name,Y),Ge=q.filter(e=>e.date===U),Qe=(0,D.guestPhone)(X),Ve=(0,D.emailOk)(ee)&&(!Ee||!!ee.trim()),Je=(0,M.needsMissing)(ve,I.allergies),Ke=!!Q&&(le||!ze.allergyConfirm)&&!Je.length&&J.trim().length>1&&Qe.ok&&Ve&&Le.ok,Xe=Je[0]??(Le.ok?Ee&&!ee.trim()?'Add your email':ze.allergyConfirm&&!le?'Confirm the allergy information':void 0:'Bringing a dog? Please phone us'),Ze=async()=>{const e=(0,M.needsPatch)(ve,I.allergies),t=we&&Be?Ae(Q).map(e=>e.table):[],o=we?ve.tableReq.find(e=>t.includes(e))??t[0]:void 0,n=await v.repo.bookings.create({restaurantId:A.id,customerId:I.id,name:J,partySize:L,...Y?{children:Y}:{},date:U,time:Q,notes:se.trim(),security:Ye,depositPaid:0,...Fe?{...(0,p.depositFields)(Ne),depositPolicy:Ue.join(' '),depositRefundable:qe.refundable,depositCutoffHours:qe.cutoffHours}:{},phone:Qe.pretty,email:ee.trim()||void 0,...(0,p.marketingChoice)(ee,ze.marketingOptIn&&re),...le?{allergyConfirmed:!0,allergyConfirmedAt:(new Date).toISOString()}:{},source:'online',...e,...!He||e.tableReq?.length||we?{}:{tableReq:[He.join('+')]},...Ie.find(e=>e.time===Q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??me,...o?{table:o}:{}});(0,a.rememberGuard)(n.id,(0,a.guardFor)({...N,hp:F})),be(n)},et=(0,v.useStore)(e=>pe?e.bookings.find(e=>e.id===pe.id)?.ref:void 0),tt=e=>(0,S.waMeLink)(A.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:et??e.ref,date:e.date,time:e.time,partySize:e.partySize},A.name));if(pe){const e='pending'===pe.status;return(0,B.jsxs)(f.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:A.name,children:[(0,B.jsx)(f.Banner,{kind:e?'info':'success',title:`Reference ${et??pe.ref}`,children:`${pe.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(pe.date))} at ${pe.time}`}),e?(0,B.jsx)(f.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(f.T,{children:["Name: ",pe.name]}),(0,B.jsxs)(f.T,{children:["Mobile: ",pe.phone]}),pe.email?(0,B.jsxs)(f.T,{children:["Email: ",pe.email]}):null,(0,B.jsxs)(f.T,{children:["Allergies shared with the restaurant: ",pe.allergies.length?pe.allergies.map(e=>`${(0,y.allergenLabel)(e.allergen)} (${(0,y.severityLabel)(e.severity)})`).join(', '):'none']}),pe.notes?(0,B.jsxs)(f.T,{children:["Notes: ",pe.notes]}):null,pe.dog?(0,B.jsxs)(f.T,{children:["\ud83d\udc15 Dog coming too",pe.table?` \xb7 dog-friendly table ${pe.table}`:'']}):null,pe.holds?.length?(0,B.jsxs)(f.T,{children:["Reserved: ",pe.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(A.settings.reservables??b.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,pe.tableReq?.length?(0,B.jsxs)(f.T,{children:["Table requested: ",pe.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===pe.security&&pe.depositDue?(0,B.jsxs)(f.T,{weight:"semibold",children:["Deposit due: ",(0,k.gbp)(pe.depositDue),". ",A.name," will tell you how to pay it."]}):null,'deposit'===pe.security&&pe.depositPolicy?(0,B.jsx)(f.Muted,{children:pe.depositPolicy}):null,(0,B.jsx)(f.Muted,{children:"Your booking details are shown above. CoverCharge emails your confirmation with a link to change or cancel."}),(0,B.jsx)(f.Muted,{children:A.phone?`Or call us on ${A.phone} and quote your booking details.`:'Or call the restaurant and quote your booking details.'})]}),tt(pe)?(0,B.jsxs)(u.default,{style:{gap:4},children:[(0,B.jsx)(f.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=tt(pe);e&&(0,S.openWhatsApp)(e)}}),(0,B.jsx)(f.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,B.jsx)(f.Button,{label:"Back to restaurant",onPress:()=>s.router.replace(`/customer/${A.id}`)})]})}return(0,B.jsxs)(f.Screen,{title:"Book a table",subtitle:A.name,footer:(0,B.jsx)(f.Button,{label:Xe||(L>(De.autoAcceptUpTo??7)?'Send booking request':'Confirm booking'),disabled:!Ke,onPress:()=>Ze(),testID:"confirm-booking"}),children:[(0,B.jsx)(M.FirstQuestions,{rid:A.id,value:ve,onChange:e=>{e.dog===ve.dog&&e.dogs===ve.dogs||V(null),Ce(e)},party:L,audience:"guest",profile:I.allergies}),(0,B.jsxs)(f.Card,{children:[(0,B.jsxs)(u.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(f.H2,{children:"Party size"}),(0,B.jsx)(o.PartySizeInput,{value:L,onChange:e=>{H(e),V(null)},min:Pe.min,max:Pe.max,label:"Party size",testID:"party-size"})]}),(0,B.jsx)(c.ChildrenCount,{guest:!0,party:L,value:Y,onChange:_,depositsOn:qe.on&&qe.perPersonPence>0,testID:"book-children"}),Fe?(0,B.jsx)(f.Banner,{kind:"info",title:Ne.preorders&&!We?`Deposit: ${(0,k.gbp)(Fe)} for pre-ordered dishes`:Ne.preorders?`Deposit: ${(0,k.gbp)(Fe)} (${(0,k.gbp)(We)} for the adults, ${(0,k.gbp)(Ne.preorders)} for pre-ordered dishes)`:Y?`Deposit: ${(0,k.gbp)(Fe)} for ${L-Y} adults (children don't count towards the ${qe.fromParty} and don't pay)`:`Deposit: ${(0,k.gbp)(Fe)} for ${L} adults`,children:(0,B.jsx)(u.default,{style:{gap:4},children:Ue.map(e=>(0,B.jsx)(f.T,{size:13,children:e},e))})}):qe.on&&qe.perPersonPence>0?(0,B.jsxs)(f.Muted,{children:["No deposit for fewer than ",qe.fromParty," adults. Children don't count towards the ",qe.fromParty," and don't pay, and staff can waive a deposit."]}):null,Le.ok?null:(0,B.jsx)(f.Banner,{kind:"warn",title:"Bringing a dog?",children:Le.why}),He&&!we?(0,B.jsxs)(f.Muted,{children:["For ",L," people we join tables ",He.join(' + ')," for you."]}):null,L>(De.autoAcceptUpTo??7)?(0,B.jsxs)(f.Muted,{children:["For ",L," people the team checks the booking first, then CoverCharge confirms by email."]}):null,we&&Be?(0,B.jsxs)(f.Muted,{children:["Dogs are welcome in the ",Oe.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",A.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Date"}),(0,B.jsx)(O.CustomerDatePicker,{r:A,today:z,value:U,events:q,onChange:e=>{G(e),V(null)}}),Ge.map(e=>(0,B.jsx)(f.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Time"}),0===Ie.length?(0,B.jsx)(f.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,B.jsx)(f.Row,{wrap:!0,gap:6,children:Ie.map(e=>(0,B.jsx)(f.Chip,{testID:`book-slot-${e.time}`,label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.leftV(e.time)},e.time))}),Te.length>0&&Ie.some(e=>e.blocked)?(0,B.jsx)(f.Banner,{kind:"info",title:Re?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${Te.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)($e)}. Please give us a ring on ${A.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,n.lastFoodOn)(A,U);return e&&Ie.some(e=>e.drinksOnly)?(0,B.jsx)(f.Banner,{kind:"info",title:`Last food orders ${(0,n.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),we&&Ie.some(e=>e.noDog)?(0,B.jsx)(f.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${Oe.map(e=>e.name).join(' and ')}${A.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,$.closedAreasAt)(je,A.id,U,Q??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,B.jsx)(f.Muted,{children:(0,j.bookingLimitsHint)(A)})]}),(0,B.jsx)(M.MoreQuestions,{rid:A.id,r:A,value:ve,onChange:Ce,party:L,date:U,time:Q,today:(0,x.ymd)(z),bookings:ke,audience:"guest",showTables:!0}),(0,B.jsxs)(f.Card,{highlight:le?void 0:w.colours.amber,children:[(0,B.jsx)(f.Field,{label:"Notes (optional)",value:se,onChangeText:ie,placeholder:ze.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"book-notes"}),ze.allergyConfirm?(0,B.jsx)(f.Toggle,{label:ze.allergyConfirmWords,value:le,onChange:ae,testID:"book-allergy-confirm"}):null,(0,B.jsxs)(f.Muted,{children:[ze.tableRequestNote," ",Ne.preorders?'Pre-ordered dishes with a deposit are shown above; the rest is paid on the night.':'Nothing here is charged now; reserved dishes are paid on the night.']})]}),(0,B.jsxs)(f.Card,{children:[(0,B.jsx)(f.H2,{children:"Your details"}),(0,B.jsx)(f.Field,{label:"Name for the booking",value:J,onChangeText:K}),(0,B.jsx)(f.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:X,onChangeText:Z,onBlur:()=>ne(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Qe.ok||!oe&&!X?null:(0,B.jsx)(f.T,{size:13,colour:w.colours.amber,children:Qe.error}),(0,B.jsx)(f.Field,{testID:"book-email",label:Ee?'Email (needed to book)':'Email (optional)',value:ee,onChangeText:te,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),(0,D.emailOk)(ee)?null:(0,B.jsxs)(f.T,{size:13,colour:w.colours.amber,children:["That email doesn\u2019t look quite right.",Ee?'':' Check it, or leave it blank.']}),ze.marketingOptIn&&ee.trim()?(0,B.jsx)(f.Toggle,{label:ze.marketingWords,value:re,onChange:de,testID:"book-marketing"}):null,(0,B.jsx)(f.Muted,{children:"CoverCharge confirms by email, with how to change or cancel. We only use your number for this booking."})]}),(0,B.jsx)(l.Honeypot,{value:F,onChange:W})]})}},1238,[843,1099,861,13,17,1239,917,85,841,1240,1079,1055,777,845,851,1105,863,858,899,804,1182,848,995,998,1076,1107,1241,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},1239,[812,17,219,85,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"maxChildren",{enumerable:!0,get:function(){return o}}),_e.ChildrenCount=function({party:e,value:t,onChange:u,depositsOn:h,testID:c="children-count",guest:p}){const f=o(e);if(f<1)return null;const x=Math.min(t,f);return(0,s.jsxs)(n.default,{style:{gap:6,alignItems:'center',width:'100%'},testID:c,children:[(0,s.jsx)(l.T,{size:17,weight:"semibold",center:!0,children:p?`How many of the ${e} are children?`:`Children in the ${e}`}),(0,s.jsx)(l.Stepper,{value:x,onChange:e=>u(Math.max(0,Math.min(f,e))),min:0,max:f,label:"children",testID:`${c}-stepper`,format:e=>e?String(e):'None'}),h?(0,s.jsx)(l.Muted,{center:!0,children:"Children don't count towards the number that needs a deposit, and never pay."}):null]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]);const o=e=>Math.max(0,Math.round(Number(e)||0)-1)},1240,[17,85,777,8]); __d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CustomerDatePicker=function({r:e,today:m,value:D,events:x,onChange:f}){const p=(0,n.ymd)(m),j=(0,r.lastBookableDay)(p,e),[C,w]=(0,t.useState)(!1),[Y,k]=(0,t.useState)((0,i.slashDay)(D)),[I,P]=(0,t.useState)(D);I!==D&&(P(D),k((0,i.slashDay)(D)));const T=new Date(m);T.setHours(12,0,0,0);const $=Array.from({length:b},(e,t)=>{const s=new Date(T);return s.setDate(T.getDate()+t),s}).filter(e=>(0,n.ymd)(e)<=j),v=t=>!!(0,o.hoursFor)(e,t),F=(0,n.parseYmd)(D),[L,M]=(0,t.useState)(()=>({y:F.getFullYear(),m:F.getMonth()})),S=(new Date(L.y,L.m,1,12).getDay()+6)%7,R=new Date(L.y,L.m+1,0).getDate(),A=[...Array.from({length:S},()=>null),...Array.from({length:R},(e,t)=>new Date(L.y,L.m,t+1,12))];for(;A.length%7;)A.push(null);const z=(0,n.parseYmd)(j),W=L.y>m.getFullYear()||L.y===m.getFullYear()&&L.m>m.getMonth(),B=L.yM(({y:t,m:s})=>{const l=new Date(t,s+e,1);return{y:l.getFullYear(),m:l.getMonth()}}),_=Y===(0,i.slashDay)(D)?null:(0,r.typedBookDateProblem)(Y,p,e),O=e=>{f(e),w(!1)},G=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,n.dayShort)(e)} ${e.getDate()}`,N=$.some(e=>(0,n.ymd)(e)===D);return(0,h.jsxs)(l.default,{testID:"cust-date",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,h.jsx)(l.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cust-date-chosen",children:(0,h.jsx)(d.T,{center:!0,weight:"semibold",colour:c.colours.goldLight,children:`Booking for ${(0,n.niceDateYear)(F)}${v(F)?'':' (closed that day)'}`})}),(0,h.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[$.map((e,t)=>{const s=(0,n.ymd)(e),l=x.some(e=>e.date===s);return(0,h.jsx)(d.Chip,{testID:`cust-day-${s}`,label:G(e,t),sub:v(e)?l?'\u2605 event':void 0:'Closed',disabled:!v(e),selected:D===s,accessibilityLabel:`${(0,n.niceDate)(e)}${v(e)?l?', event':'':', closed'}`,onPress:()=>O(s)},s)}),N?null:(0,h.jsx)(d.Chip,{label:(0,n.niceDate)(F),sub:v(F)?void 0:'Closed',selected:!0,onPress:()=>w(!0),accessibilityLabel:`Chosen: ${(0,n.niceDateYear)(F)}. Opens the calendar`})]}),(0,h.jsxs)(l.default,{style:{width:'100%',maxWidth:360,gap:4},children:[(0,h.jsx)(d.Field,{label:"Any other date (DD/MM/YYYY)",testID:"cust-date-typed",value:Y,placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10,autoCapitalize:"none",autoCorrect:!1,style:{textAlign:'center'},accessibilityLabel:"Booking date, typed as day, month and four-digit year",onChangeText:t=>{const s=(0,i.slashDate)(t,Y);k(s);const l=(0,i.dayFromSlash)(s);l&&!(0,r.typedBookDateProblem)(s,p,e)&&f(l)}}),_&&Y.length>=10?(0,h.jsx)(d.T,{center:!0,size:15,colour:c.colours.amber,testID:"cust-date-problem",children:_}):null]}),(0,h.jsx)(d.Button,{kind:"secondary",label:C?'Hide calendar':'\ud83d\udcc5 Pick a date from a calendar',testID:"cust-date-cal",style:{minHeight:48},accessibilityLabel:C?'Hide the calendar':'Pick a date from a month calendar',onPress:()=>{C||M({y:F.getFullYear(),m:F.getMonth()}),w(!C)}}),C?(0,h.jsxs)(l.default,{testID:"cust-calendar",style:{borderWidth:1,borderColor:c.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:c.colours.surface2,width:'100%',maxWidth:420},children:[(0,h.jsx)(l.default,{style:{alignItems:'flex-end'},children:(0,h.jsx)(u.GoldClose,{label:"Close the calendar",testID:"cust-calendar-close",onPress:()=>w(!1),size:"sm"})}),(0,h.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",accessibilityState:{disabled:!W},disabled:!W,onPress:()=>H(-1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:W?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u2039"})}),(0,h.jsxs)(d.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:[(0,n.monthLong)(L.m)," ",L.y]}),(0,h.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Next month",accessibilityState:{disabled:!B},disabled:!B,onPress:()=>H(1),style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B?1:.3},children:(0,h.jsx)(d.T,{size:22,colour:c.colours.gold,children:"\u203a"})})]}),(0,h.jsx)(l.default,{style:{flexDirection:'row'},importantForAccessibility:"no-hide-descendants",children:y.map(e=>(0,h.jsx)(d.T,{size:12,colour:c.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:A.length/7},(e,t)=>(0,h.jsx)(l.default,{style:{flexDirection:'row',gap:4},children:A.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,h.jsx)(l.default,{style:{flex:1,height:44}},t);const o=(0,n.ymd)(e),i=oj,r=o===D,u=!v(e);return(0,h.jsx)(s.default,{testID:`cust-cal-${o}`,accessibilityRole:"button",accessibilityLabel:`${(0,n.niceDateYear)(e)}${i?', not bookable online':u?', closed':''}`,accessibilityState:{disabled:i||u,selected:r},disabled:i||u,onPress:()=>O(o),style:{flex:1,height:44,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:o===p?1.5:0,borderColor:c.colours.gold,backgroundColor:r?c.colours.gold:'transparent',opacity:i?.3:1},children:(0,h.jsx)(d.T,{size:15,center:!0,weight:r?'bold':'regular',colour:r?c.colours.onGold:u?c.colours.muted:c.colours.text,style:u&&!i?{textDecorationLine:'line-through'}:void 0,children:e.getDate()})},t)})},t)),(0,h.jsxs)(d.Muted,{center:!0,children:["Crossed-out days: closed. ",(0,r.bookAheadUnlimited)(e)?`You can book up to ${(0,i.slashDay)(j)}.`:`Online booking is open up to ${(0,i.slashDay)(j)}.`]})]}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),o=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=14},1241,[17,385,85,862,863,1033,1242,804,777,779,8]); @@ -1351,7 +1351,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1268,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1269,[]); __d(function(g,r,i,a,m,e,d){"use strict";function t(){return null}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},1270,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1271,[17,385,85,409,777,804,1184,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1271,[17,385,85,409,777,804,1185,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t,signedOff:!1}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1272,[813,17,319,378,385,278,85,1244,777,910,845,911,863,804,1019,8,1273]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1273,[]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},1274,[17,85,1275,777,858,920,1252,1255,804,8]); @@ -1414,7 +1414,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1331,[812,843,17,85,777,845,851,1154,1332,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1332,[928,899,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1333,[13,17,856,1334,1407,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1053,779,805,806,1335,813,1336,1094,843,1140,1337,1338,1339,1091,1122,1340,1341,1346,1347,1204,1348,856,1353,1354,1355,1115,1113,920,1356,1153,891,1104,1357,17,1072,1179,1018,1087,1358,21,378,363,385,278,85,409,1359,19,777,1231,1235,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1360,1108,1361,1367,1369,1373,1378,1372,1379,1382,1383,1117,1095,1096,862,1388,1220,1389,1230,1222,995,1394,1399,1400,1054,1052,1119,1402,1403,1404,1071,1172,1405,1171,1162,853,1349,1406,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1053,779,805,806,1335,813,1336,1094,843,1140,1337,1338,1339,1091,1122,1340,1341,1346,1347,1204,1348,856,1353,1354,1355,1115,1113,920,1356,1153,891,1104,1357,17,1072,1180,1018,1087,1358,21,378,363,385,278,85,409,1359,19,777,1231,1235,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1360,1108,1361,1367,1369,1373,1378,1372,1379,1382,1383,1117,1095,1096,862,1388,1220,1389,1230,1222,995,1394,1399,1400,1054,1052,1119,1402,1403,1404,1071,1172,1405,1171,1162,853,1349,1406,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1337,[]); @@ -1474,7 +1474,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1391,[831,858,998,1390,1392,1393]); __d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1392,[843]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1393,[219,1392]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1394,[843,17,1183,1172,385,85,995,998,862,863,804,777,1395,1398,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1394,[843,17,1184,1172,385,85,995,998,862,863,804,777,1395,1398,8]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1395,[1396,854,843,17,264,378,385,278,85,858,995,998,1397,863,804,1026,777,1398,1350,899,1338,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1396,[]); __d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1397,[862,863,861]); @@ -1494,7 +1494,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1411,[13,17,1412,856,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1412,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1413,[13,17,856,1414,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1414,[1415,1419,813,912,1072,1420,1203,1204,1028,1025,1026,1421,1423,1426,1153,891,978,1428,975,880,1031,1032,1429,914,1008,915,17,1155,1231,1235,1197,356,385,278,85,409,19,777,857,876,804,1161,1430,1066,1084,1086,1081,1027,1010,1057,1437,1438,1439,1447,1448,920,219,1236,1176,1182,1444,1196,1193,1453,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1414,[1415,1419,813,912,1072,1420,1203,1204,1028,1025,1026,1421,1423,1426,1153,891,978,1428,975,880,1031,1032,1429,914,1008,915,17,1155,1231,1235,1197,356,385,278,85,409,19,777,857,876,804,1161,1430,1066,1084,1086,1081,1027,1010,1057,1437,1438,1439,1447,1448,920,219,1236,1176,1183,1444,1196,1179,1453,1180,878,1206,1207,884,776,899,8]); __d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1415,[812,17,1018,378,85,1108,1109,1361,1394,777,995,998,863,804,1057,999,1416,1417,1020,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1416,[812,17,385,85,777,804,998,805,999,856,899,8]); __d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1417,[17,85,777,998,1418,842,804,1038,928,8]); @@ -1510,11 +1510,11 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1427,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1428,[219,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1429,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1430,[805,1427,1095,1262,1431,812,822,1117,1118,1091,1122,1432,1114,1119,1402,1403,1057,1338,996,1120,1089,841,1381,1125,1434,1231,1435,1394,1078,1055,1090,17,85,777,1358,858,845,851,863,1316,804,1178,1098,1115,998,1355,1062,1162,1436,1222,899,1180,1399,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1430,[805,1427,1095,1262,1431,812,822,1117,1118,1091,1122,1432,1114,1119,1402,1403,1057,1338,996,1120,1089,841,1381,1125,1434,1231,1435,1394,1078,1055,1090,17,85,777,1358,858,845,851,863,1316,804,1178,1098,1115,998,1355,1062,1162,1436,1222,899,1181,1399,862,8]); __d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1431,[806,17,85,777,899,1266,8]); __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1432,[17,385,85,1433,899,928,804,777,8]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1433,[]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1434,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1434,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1182,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1435,[17,385,1172,777,804,8]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1436,[17,85,864,858,848,804,777,8]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1437,[17,1395,1057,8]); @@ -1533,10 +1533,10 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1450,[17,278,85,777,857,804,1451,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1451,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1452,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1453,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1441,1162,860,1180,853,1178,884,1355,998,843,1115,1193,1200,1071,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1453,[1180,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1441,1162,860,1181,853,1178,884,1355,998,843,1115,1179,1200,1071,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1454,[13,17,856,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1455,[1456,899,778,1408,1458,995,13,1485,479,17,368,319,219,24,85,805,857,1065,856,1487,19,858,998,876,804,1448,920,988,1490,1491,1028,1104,880,1008,914,1493,1378,8,1494,1495,1496,1497]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1456,[880,812,17,219,366,85,777,1457,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1456,[880,812,17,219,366,85,777,1457,899,804,1183,920,876,909,8]); __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1457,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1458,[1459,1482,1484]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1459,[198,1460,1463,1477,1478,1479,1480,1481]); diff --git a/staff-app/admin.html b/staff-app/admin.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/admin.html +++ b/staff-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer.html b/staff-app/customer.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer.html +++ b/staff-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage.html b/staff-app/customer/anchorage.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage.html +++ b/staff-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/book.html b/staff-app/customer/anchorage/book.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/book.html +++ b/staff-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/feedback.html b/staff-app/customer/anchorage/feedback.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/feedback.html +++ b/staff-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/gift.html b/staff-app/customer/anchorage/gift.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/gift.html +++ b/staff-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/lost.html b/staff-app/customer/anchorage/lost.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/lost.html +++ b/staff-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/loyalty.html b/staff-app/customer/anchorage/loyalty.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/loyalty.html +++ b/staff-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/merch.html b/staff-app/customer/anchorage/merch.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/merch.html +++ b/staff-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/offers.html b/staff-app/customer/anchorage/offers.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/offers.html +++ b/staff-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/refer.html b/staff-app/customer/anchorage/refer.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/refer.html +++ b/staff-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/waitlist.html b/staff-app/customer/anchorage/waitlist.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/waitlist.html +++ b/staff-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/whatson.html b/staff-app/customer/anchorage/whatson.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/anchorage/whatson.html +++ b/staff-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/basket.html b/staff-app/customer/basket.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/basket.html +++ b/staff-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/profile.html b/staff-app/customer/profile.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/customer/profile.html +++ b/staff-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/demo.html b/staff-app/demo.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/demo.html +++ b/staff-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/display.html b/staff-app/display.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/display.html +++ b/staff-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/index.html b/staff-app/index.html index 41e7e6556f5501a304f95b24686025bf35589a1d..3d80c927654517dfd8d108cd2081a40e1701c6cb 100644 --- a/staff-app/index.html +++ b/staff-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/kitchen.html b/staff-app/kitchen.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/kitchen.html +++ b/staff-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/owner.html b/staff-app/owner.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/owner.html +++ b/staff-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/staff.html b/staff-app/staff.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/staff.html +++ b/staff-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/sw.js b/staff-app/sw.js index 525fa64ed6a690f0cc778f0fbdc56e3c81f55085..340f757954e93b956c4d80346f8ca666686f9b26 100644 --- a/staff-app/sw.js +++ b/staff-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Staff service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-staff-a10577da74"; +const V = "cc-staff-fe4652eb24"; const BASE = "/staff-app/"; -const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=a10577da7483140da4e67c6fdb865a62e0ca6016e9f2a0271fc191f2653cbcdb"]; +const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=fe4652eb2461ffd63a913df7bd5b3df8ec6691f1f497262914389a5e0d3a495b"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/staff-app/team.html b/staff-app/team.html index 0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce..9adf92dcd8da139e905e41b3b0bb3296fc027fb3 100644 --- a/staff-app/team.html +++ b/staff-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - +